Build a Next.js Application with TypeScript
Learn how to use Typescript to build a Next.js application.
Build a Next.js Application with TypeScript
Learn how to use Typescript to build a Next.js application.
Sam
Now, under your pages\api folder create a new folder called auth if one doesn’t exist yet. Add a file called […nextauth].ts. Add the following code to it.
This is unclear. What is the full file path needed, are there multiple file stubs?
Steve
’[…nextauth].ts’ is actually the file name and the full path is: pages/api/auth/[…nextauth].ts.
Sam
How will handling our own custom login page work?
Юрий Яковенко
Have 404 page when trying to login
Юрий Яковенко
Please make sure that you specify OKTA_DOMAIN in correct way in .env.local file
OKTA_DOMAIN=dev-XXXXXXXX.okta.com WRONG
OKTA_DOMAIN=dev-XXXXXXXX.okta.com/oauth… CORRECT!
Otherwise you’ll get 404
BR Yuriy
John Fay
Hey Sam! I just use a login function where I pass in the provider as a string.
const login = async (provider: string) => {
await signIn(provider, { callbackUrl: ‘/’ });
};
Style your login page as much as you want and pass in () => login(‘okta’)
to your sign in button
Noah Stolmaker
I wish I had read this 2 hours ago!
Dimitrios Filippou
I get an error when logging in
POST http://localhost:8084/api/auth/signin/okta? 404 (Not Found) so basically it cannot find the API route. Any ideas why this happens?
Kai Elwood-Dieu
I’m getting a 400 (bad request) error after changing my OKTA_DOMAIN from “{dev-XXXXXXXX.okta.com}” to “dev-XXXXXXXX.okta.com/oauth…”. Any thoughts as to why? Thanks!
Kai Elwood-Dieu
Figured it out. Silly mistake – didn’t take out the {} in my clientID or secret
Sam
Sorry for the slow reply. Got it working for Pory thank you!
kaseymccurdy
Will this allow people to sign into the app with their social credentials THROUGH / Via okta?
David Davis
When I run the app I get TypeError: Cannot use ‘in’ operator to search for ‘#<syntheticbaseevent>’ in null
when I click on the login button. https://uploads.disquscdn.c…
Thoughts why this is happening?
John Andrews
When signing out from next-auth (using SignOut() function given by ‘next-auth/client’) it only signs out from the next backend but not from OKTA - so the next login will proceed without prompt which is not the expected behaviour when you want to change your user. Do you have an idea how to force a full logout so that next login click requires username password again? ^^
2nd:
As mentioned below the OKTA_DOMAIN from next-auth > v3.1 needs to have an ‘/oauth2’ attached to work correctly…
Ron Nelson
This is related to the comments above. You’ll need to append oauth2 to the end of your okta domain url.
sanjay rajeev
After login and while redirecting to http://localhost:3000 I get this error in terminal Error: unable to get local issuer certificate
Please help me out with issue
sanjay rajeev
@disqus_Na2CdR5NOC I am stuck with the same issue for signOut please somebody help us with it
sanjay rajeev
Solved this issue by adding process.env.NODE_TLS_REJECT_UNAUTHORIZED=0
sanjay rajeev
I am unable to signOut it just redirects to the page where I have to login again but if I click on login it wont ask for any credentials it will directly keep me logged in . Please help me with this guys anybody please