OpenID Connect Authentication with NestJS, React and MongoDB
Related blog post at https://sdoxsee.github.io/blog/2020/02/05/cats-nest-nestjs-mongo-oidc
OpenID Connect Authentication with NestJS, React and MongoDB
OpenID Connect Authentication with NestJS, React and MongoDB
Related blog post at https://sdoxsee.github.io/blog/2020/02/05/cats-nest-nestjs-mongo-oidc
Do you know any other openid connect implementation with nest.js and passport?
async validate(tokenset: TokenSet): Promise<any> {
const userinfo: UserinfoResponse = await this.client.userinfo(tokenset);
try {
const id_token = tokenset.id_token
const access_token = tokenset.access_token
const refresh_token = tokenset.refresh_token
const user = {
id_token,
access_token,
refresh_token,
userinfo,
}
console.log(user)
Hello there !
Some time ago I followed your (awesome) article, to implement OIDC authentication in a NestJS app, but sometimes when I log myself in, I get on a {"statusCode":401,"message":"Unauthorized"}
page. Nothing appears in NestJS logs, nothing else on the web page.
I'm hence creating this issue, so we can (hopefully) find the cause and solve it, all together ๐
I tried adding log lines in your code to find where it was stopping, and the last one appears before
, that's the only clue I have for nowLearning the flow of OAuth and OpenID in NestJS
OAuth 2.0 Client IDs
OAUTH2_CLIENT_REGISTRATION_LOGIN_REDIRECT_URI=https://jsnodetest-onstarrynight685392.codeanyapp.com/callback
OAUTH2_CLIENT_REGISTRATION_LOGIN_POST_LOGOUT_REDIRECT_URI=https://jsnodetest-onstarrynight685392.codeanyapp.com/logout
I tried OAUTH2_CLIENT_REGISTRATION_LOGIN_POST_LOGOUT_REDIRECT_URI for https://jsnodetest-onstarrynight685392.codeanyapp.com, https://jsnodetest-onstarrynight685392.codeanyapp.com/, https://jsnodetest-onstarrynight685392.codeanyapp.com/logout,
Anything that the error would occur?
(node:1185) UnhandledPromiseRejectionWarning: TypeError: only valid absolute URLs can be requested
at module.exports (/home/cabox/workspace/cats-nest/back-end/node_modules/openid-client/lib/helpers/is_absolute_url.js:10:11)
at Function.request (/home/cabox/workspace/cats-nest/back-end/node_modules/openid-client/lib/helpers/request.js:27:3)
at Function.discover (/home/cabox/workspace/cats-nest/back-end/node_modules/openid-client/lib/issuer.js:215:38)
at req.session.destroy (/home/cabox/workspace/cats-nest/back-end/dist/auth/auth.controller.js:30:62)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1185) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:1185) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.