pedroetb/node-oauth2-server-mongo-example

can this play nicely with Next-authJS

redimongo opened this issue · 3 comments

I am trying to work out how to create a provider that connects this to Next-Auth JS.

this is the information that they provide.
https://next-auth.js.org/configuration/providers/oauth#authorization-option

However the issue is that this code has no

authorization: {
  url: "https://example.com/oauth/authorization", // WHERE DO I POINT THIS TOO?
  params: { scope: "email" }
}

Hi, I don't know Next-authJS, but should work if it is compliant with OAuth2 specification. You can point that url to your host (where you are running oauth server), like http://localhost:3000/.

Remember, this projects is an usage example of https://github.com/oauthjs/node-oauth2-server, maybe you can check their official documentation at https://oauth2-server.readthedocs.io/en/latest/.

thank you for your comment. The problem is I can't see the authorize section of this code, nor how does it seem to fit in with these documentation https://next-auth.js.org/configuration/providers/oauth#using-a-custom-provider

basically how would I link it to make it look like this

Mainly data missing is wellKnown, authorization and Profile

{
  id: "google",
  name: "Google",
  type: "oauth",
  wellKnown: "https://accounts.google.com/.well-known/openid-configuration", //WHERE IS THIS IN THE node-oauth2-server-mongo-example
  authorization: { params: { scope: "openid email profile" } },
  idToken: true,
  checks: ["pkce", "state"],
  profile(profile) {
    return {
      id: profile.sub,
      name: profile.name,
      email: profile.email,
      image: profile.picture,
    }
  },
}

I think these features are not available at https://github.com/oauthjs/node-oauth2-server nor covered at this example project, sorry.