I am using Okta with next-auth.js. Since I'm only using 1 providers (I will be using more providers inside Okta login), may I just skip this page and go directly to Okta login page? If yes, how?

Asked
Active
Viewed 7,492 times
22
Boubou
- 632
- 5
- 18
-
Up with this question. I'm trying to skip this page as well. Per documentation: "If you want to create a custom sign in link you can link to /api/auth/signin/[provider] which will sign in the user in directly with that provider." I used `Sign in with Google` with no avail. Still pushing me at the default login page – crrmacarse Mar 25 '21 at 10:57
-
1UPDATE: I have raised the issue here: https://github.com/nextauthjs/next-auth/issues/1582 – crrmacarse Mar 26 '21 at 12:06
1 Answers
36
You can utilize signIn to skip directly to the provider sign in page
<button type="button" onClick={() => signIn([provider])}>Sign in with Provider</a>
Replace provider with the provider.id you want to use. In your scenario, it'll be signIn('okta')
refer: https://next-auth.js.org/getting-started/client#signin
pensum
- 980
- 1
- 11
- 25
crrmacarse
- 1,176
- 1
- 8
- 22
-
2This does not work inside getStaticProps or getServerSideProps – Design by Adrian Oct 14 '21 at 11:05
-