mak76
July 28, 2021, 7:44am
1
I would like to achieve the same as the answer using nextjs-auth0 SDK. After successfully completing the login process, I would like to redirect the user to another URL i.ie. “/dashboard” not to “/”.
Hi.
It looks like what is happening is expected.
Our Angular SDK is configured to work as follows:
User initiates login by calling loginWithRedirect
User is redirected to Auth0, including a redirectUri (in this case /callback)
User is, after succesful authentication, redirected back to the provided redirectUri (in this case /callback)
The callback URL is used only to process code and state in order to retrieve an actual token
The user is then redirected again to /
However, if you want to …
Code in my api/auth/[…auth0].js page
import { handleAuth, handleCallback } from "@auth0/nextjs-auth0";
export default handleAuth();
Configuration:
#AUTH0 CONFIGURATION
AUTH0_SECRET=*****************************************
AUTH0_BASE_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=https://****.us.auth0.com
AUTH0_CLIENT_ID=*****************************************
AUTH0_CLIENT_SECRET=*****************************************
AUTH0_AUDIENCE=*****************************************
Other information:
SDK: nextjs-auth0
version: ^1.5.0
next-js: 11.0.1
How can I achieve it? Please let me know if the question is not clear.
mak76
August 2, 2021, 11:11am
2
Bumping!!!
I will highly appreciate your help/hints.
If you’re looking to send all signed in users to the same path, here’s the code I am using
import { handleAuth, handleLogin } from "@auth0/nextjs-auth0";
export default handleAuth({
async login(req, res) {
await handleLogin(req, res, {
returnTo: "/##DESIREDPATH##",
});
},
});
I do know you can use some neat stuff with the returnTo configurations, I’d check out the SDK directly for more specific exmaples
https://github.com/auth0/nextjs-auth0
5 Likes
Thanks for sharing it with the rest of community!
1 Like
mak76
August 3, 2021, 10:46am
5
Thank you so much. I will check the SDK return to configuration.
No worries! Let us know if you have any other questions down the road!
system
Closed
August 18, 2021, 11:12am
7
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.