For a custom provider, where does the "authorization endpoint" go? #10802
Unanswered
stuvjordan-uroc
asked this question in
Help
Replies: 1 comment
-
in the custom provider you can add this: authorization: {
url: 'https://somesite.xyz/oauth2/authorization.'
params: {
scope: 'openid profile',
response_type: 'code',
},
}, A well-known endpoint is just an endpoint that returns ALL of the various endpoints associated with an Oauth2 flow (authorization, token, profile, etc) if you add that, you don't need to add all these granular endpoints |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, this is the first time I've ever tried to write a nextjs app that features authentication via OAuth2, so apologies in advance for what is probably a dumb question.
I'm trying to build a nextjs app through which I can access my data from https://flow.polar.com/. That website offers an api that allows third party apps to do so. I'm trying to use Auth.js to handle the required authentication.
flow.polar.com is pretty niche, so unsurprisingly, Auth.js doesn't have a built-in provider for it. So I'm trying to use my own provider. Attempting to do this, I've followed the instructions at https://authjs.dev/guides/configuring-oauth-providers#use-your-own-provider, using the github auth setup as a model, as the docs suggest newbies who need a custom provider do.
Here's my auth.ts:
When I deploy my app and click on the sign in button (generated by code modeled step 4 of the github walk through), I get a 404 error. Here's the fragment generating the sign-in button:
My suspicion is that I get a 404 at the sign in button because there is no place in my code that specifies the url where a user is actually supposed to submit their credentials to the polar api service. (Is this the url that seems to be called an "authentication endpoint" in the lingo???) The docs for the api I'm trying to authenticate to say that this endpoint is https://flow.polar.com/oauth2/authorization.
So, I have been reading and re-reading, searching and control-Fing the Auth.js docs to try to understand where in the code that url is supposed to go. But thus far no luck.
One guess I have is that it might go in the "issuer" attribute of the object passed to the "providers" argument of
NextAuth
inauth.ts
. But the comments on this attribute in the example code in the docs say "to infer the .well-known/openid-configuration URL". But since this api I'm trying to use uses oAuth, I'm guessing that doesn't apply? (or does it?) And "well-known configuration" doesn't sound to me anything like "authorization endpoint" anyway.So...where does the authorization endpoint go? (Or am I completely wrong that its needed in the code somewhere?)
Obviously, there is some basic knowledge about how oAuth works and how to use it in a react app that the Auth.js docs assume that I do not have. I'll be very grateful to responses that point me to what I should read to gain that understanding!!!
Beta Was this translation helpful? Give feedback.
All reactions