Ionic framework 在ionic 4中对MSDAL进行身份验证后,正确的重定向URI是什么?

Ionic framework 在ionic 4中对MSDAL进行身份验证后,正确的重定向URI是什么?,ionic-framework,azure-active-directory,Ionic Framework,Azure Active Directory,我的问题是:当我从我的Ionic 4应用程序进行身份验证时,我想将其重定向到应用程序根页面。authContext.acquireTokenAsync的正确重定向URI是什么?我有个错误 微软的回答 The reply url specified in the request does not match the reply urls configured for the application: '1111111111111111111111111111'. 我使用这样的代码 let au

我的问题是:当我从我的Ionic 4应用程序进行身份验证时,我想将其重定向到应用程序根页面。authContext.acquireTokenAsync的正确重定向URI是什么?我有个错误

微软的回答

 The reply url specified in the request does not match the reply urls configured for the application: '1111111111111111111111111111'.
我使用这样的代码

let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');

authContext.acquireTokenAsync('https://graph.windows.net', 'ClinetID', 'http://localhost:8000','','')
    .then((authResponse: AuthenticationResult) => {
      console.log('Token is' , authResponse.accessToken);
      console.log('Token will expire on', authResponse.expiresOn);
    })
    .catch((e: any) => console.log('Authentication failed', e));

您需要使用建议的重定向url或使用cutom重定向url在Active directory上将应用注册为本机应用

我使用
urn:ietf:wg:oauth:2.0:oob
作为重定向url,因此代码应该是

authContext.acquireTokenAsync('https://graph.windows.net','<Your Native App client ID>' , 'urn:ietf:wg:oauth:2.0:oob', '', null)
authContext.acquireTokenAsync('https://graph.windows.net','',urn:ietf:wg:oauth:2.0:oob','',null)

注意:您必须保持azure portal中的重定向url与代码中的重定向url相同。

您需要使用建议的重定向url将应用注册为Active directory上的本机应用,或使用cutom重定向url

我使用
urn:ietf:wg:oauth:2.0:oob
作为重定向url,因此代码应该是

authContext.acquireTokenAsync('https://graph.windows.net','<Your Native App client ID>' , 'urn:ietf:wg:oauth:2.0:oob', '', null)
authContext.acquireTokenAsync('https://graph.windows.net','',urn:ietf:wg:oauth:2.0:oob','',null)

注意:您必须保持azure门户中的重定向url和代码中的重定向url相同。

Tony Ju,你好!非常感谢您的回答。这是工作。我收到了令牌和令牌到期的时间。你能解释一下我接下来需要用这个代币做什么吗?@anton_klochko很高兴它能用。此答案适用于“当我从Ionic 4应用程序进行身份验证时,我希望将其重定向到应用程序根页面”。对于你的新版本,你能发布一个新的更详细的吗?事实上,我不知道你需要什么。@anton_klochko请接受它作为答案(单击答案旁边的复选标记,将其从灰色变为填充)。那么这个问题就可以解决了。谢谢。东尼·朱,你好!非常感谢您的回答。这是工作。我收到了令牌和令牌到期的时间。你能解释一下我接下来需要用这个代币做什么吗?@anton_klochko很高兴它能用。此答案适用于“当我从Ionic 4应用程序进行身份验证时,我希望将其重定向到应用程序根页面”。对于你的新版本,你能发布一个新的更详细的吗?事实上,我不知道你需要什么。@anton_klochko请接受它作为答案(单击答案旁边的复选标记,将其从灰色变为填充)。那么这个问题就可以解决了。非常感谢。