Auth0 Home Blog Docs

Unable to redirect to proper URL

html5mode
angularjs
redirecturi

#1

Hi Team , I am using LOCK 11 in my application with html5mode disabled . The redirect url I have specified as http://192.168.31.160:8000/#/subscribe but whenever I try logging in , it redirects to http://192.168.31.160:8000/#/home (default web page) .
Also , I intercepted the url before redirecting , it is http://192.168.31.160:8000/#access_token=abc&expires_in=7200&token_type=Bearer&state=def&id_token=ghi .Shouldn’t it be something like http://192.168.31.160:8000/#/subscribe#access_token=abc.
Do let me know what seems to be the issue .
Adding code for reference :
myApp.config('lockProvider', '$locationProvider', '$urlRouterProvider', function(lockProvider, $locationProvider, $urlRouterProvider) { lockProvider.init({ clientID: "abc", leeway: 240, domain: "def.auth0.com", options: { autoclose: true, auth: { responseType: 'token id_token', audience: 'https://' + 'def.auth0.com' + '/userinfo', redirectUrl: window.location.origin + '/#/subscribe' }, languageDictionary: { "title": "def" }, theme: { labeledSubmitButton: false, logo: 'favicon.svg', primaryColor: '#FED039' } } }); $locationProvider.hashPrefix(''); } ]); and handle authentication as function
` handleAuthentication() {

// uncomment if you are not using HTML5Mode

lock.interceptHash();

lock.on(‘authenticated’, function(authResult) {

if (authResult && authResult.accessToken && authResult.idToken) {

setSession(authResult);
} });
lock.on(‘authorization_error’, function(err) {
console.log(err);
alert( 'Error: ’ + err.error + ‘. Check the console for further details.’ ); }); } `


#2

Could you share a snippet of code from your authentication request?


#3

Hi @ricardo.batista , updated description with code . Sorry for the messy code , I tried putting it properly thrice , but it seems to fallback to this format.