javascript - Ionic __Azure AD 身份验证错误:用户取消了流程
问题描述
我在 ionic 3。我想获取访问令牌以调用其余 API。这是我的仓库https://my-app.visualstudio.com/_apis/projects?api-version=2.0 和 Ionic 配置文件在这里。但是运行此代码后我收到一条错误消息。
//Here is code
let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/tenant-id');
authContext.acquireTokenAsync(
'https://my-app.visualstudio.com/_apis/projects?api-version=2.0',
'app_id',
window.location.origin + '/',
'email',
null
)
.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));
}
错误信息
'Authentication failed Error: User cancelled the flow RequestId:679502144 CorrelationId: 9b553979-94a5-482e-b9f8-a91aba56108a
at fail (CordovaBridge.js:37)
at Object.callbackFromNative (cordova.js:293)
at <anonymous>:1:9'}
解决方案
推荐阅读
- r - 具有来自不同数据集的变量的 MANOVA
- wordpress - Woocommerce 3.5 中的产品结构化数据错误
- java - JavaFX 将列表视图设置为可编辑
- android - 尝试在空对象引用上调用虚拟方法 com.google.firebase.iid.FirebaseInstanceId.getInstanceId()'
- c# - c#:在没有管理员权限的 https 上设置 HttpListener
- sql - PLS-00103 遇到符号
- angular - RxJS - 只订阅一次但不完成 Observable
- java - 如何使用spring数据将文档插入到mongodb中的特定集合?
- c++ - union 和 struct 的字节大小
- odoo - 从 Javascript Odoo 12 打印 PDF 报告