Angular 在ionic 4中对MSDAL进行身份验证后,重定向URL是什么?
当用户成功通过身份验证时,我想将其重定向到应用程序根页面。authContext.acquireTokenAsync的重定向URL是什么Angular 在ionic 4中对MSDAL进行身份验证后,重定向URL是什么?,angular,azure,ionic-framework,cordova-plugins,adal,Angular,Azure,Ionic Framework,Cordova Plugins,Adal,当用户成功通过身份验证时,我想将其重定向到应用程序根页面。authContext.acquireTokenAsync的重定向URL是什么 let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common'); authContext.acquireTokenAsync('https://graph.windows.ne
let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');
authContext.acquireTokenAsync('https://graph.windows.net', this.clientId, 'http://localhost:8100/')
.then((authResponse: AuthenticationResult) => {
alert('Token is' + authResponse.accessToken);
alert('Token will expire on' + authResponse.expiresOn);
this.statusBar.styleDefault();
this.splashScreen.hide();
this.nav.setRoot(HomePage);
})
.catch((e: any) => {
alert('Authentication failed'+ e);
this.nav.setRoot(HomePage);
});
问题是该应用已在azure active directory上注册为WebApp。我已在active directory上将新应用注册为本机应用。通过重定向url“urn:ietf:wg:oauth:2.0:oob”,它现在可以完美地工作。这是我的密码
let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');
authContext.acquireTokenAsync('https://graph.windows.net','<Your Native App client ID>' , 'urn:ietf:wg:oauth:2.0:oob', '', null)
.then((authResponse: AuthenticationResult) => {
this.presentToast('Token is' + authResponse.accessToken + ' and expires on ' + authResponse.expiresOn);
this.statusBar.styleDefault();
this.splashScreen.hide();
this.nav.setRoot(HomePage);
})
.catch((e: any) => {
this.presentToast('Authentication failed ' + e)
})
让authContext:AuthenticationContext=this.msAdal.createAuthenticationContext('https://login.windows.net/common');
authContext.acquireTokenAsync('https://graph.windows.net','',urn:ietf:wg:oauth:2.0:oob','',null)
。然后((authResponse:AuthenticationResult)=>{
this.presentToast('令牌为'+authResponse.accessToken+',并在'+authResponse.expiresOn'到期);
this.statusBar.styleDefault();
这个.splashScreen.hide();
this.nav.setRoot(主页);
})
.catch((e:any)=>{
this.presentToast('身份验证失败'+e)
})
我也在找同样的。