Generate authorization URL server side? #2719
Unanswered
alessandrojcm
asked this question in
Help
Replies: 1 comment 8 replies
-
Assuming you will have a custom provider, I would rather use
https://next-auth.js.org/getting-started/client#signin You could start it from getServerSideProps also though https://next-auth.js.org/getting-started/rest-api#post-apiauthsigninprovider this might also be useful the returned url then can be visited with I wouldn't use getServerSideProps, only if it's absolutely necessary for your usecase though. What do you hope to gain by using it? |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, we're currently working on migrating our in-house authorization implementation to a third party solution (Fusionauth). For this we've decided to use next-auth for our application.
Now, we want this to be as transparent as possible for our users. Thus, we think that having a home page that just redirects to the OAuth provider would cause confusion. So my question is, is there a way of generating the authorization URL on
getServerSideProps
? (is this even a good idea?).I know calling the
/api/auth/signin/fusionauth
endpoint directly fromgetServerSideProps
won't work. By reading next-auth code, I can see that this is achieved by using thegetAuthorizationUrl
function, but this is not a public API. So, any ideas on how could we achieve this?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions