Auth0 Home Blog Docs

Redirect to URL after login

login
redirect

#1

I have a link that is sent in an email to users. The link is http://www.myapp.com/invite?id=123456789 When the user clicks on the link they are forced to authenticate (which is what I want). But then they are redirected back to http://www.myapp.com instead of http://www.myapp.com/invite. If someone can show me what code is needed where to make this work that would be awesome.


#2

If using Lock, you will need to set the appropriate redirectUrl configuration option:
https://auth0.com/docs/libraries/lock/v10/customization#redirecturl-string-

If using the API, you will need to pass the redirect_uri parameter:
https://auth0.com/docs/api/authentication#social


#3

I am using Lock. I changed the redirectUrl to http://www.myapp.com/invite but that doesnt work. Here is what my code looks like. I want the user to be redirected (http://www.myapp.com/invite) which is the link that is sent in an email. I feel like this should be easy but not able to find the right code to solve the problem. I am also using .NET. Any help is greatly appreciated!

var lock = new Auth0Lock(’@ConfigurationManager.AppSettings"auth0:ClientId"]’, ‘@ConfigurationManager.AppSettings"auth0:Domain"]’,
{
container: ‘root’,
languageDictionary: {
title: “login”
},
auth: {
redirectUrl: window.location.origin + ‘/signin-auth0’,
responseType: ‘code’,
params: {
scope: ‘openid’
}
}
});
lock.show();

@prashant


#4