检查令牌如何有效?
我运行这个,稍后我得到令牌,但是我想检查是否有效。
@action
signIn() {
const loginRequest = {
scopes: ["User.ReadWrite"]
}
this.userAgentApplication.loginRedirect(loginRequest);
this._isLoggedIn = true;
}发布于 2020-06-18 19:50:13
在应用程序的注册屏幕上,单击左边的API权限刀片,打开我们添加到应用程序所需的Apis访问的页面。
单击“添加权限”按钮,然后确保选中“我的API”选项卡。在API列表中,选择。在“委托权限”部分,在列表中选择Access 'TodoListService-ManualJwt‘。必要时使用搜索框。单击底部的“添加权限”按钮。
public void ConfigureAuth(IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new TokenValidationParameters {
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
},
});
}请参阅本文件以获取基于web的令牌验证
发布于 2020-06-18 18:02:55
按照这里的文档:https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-sign-in?tabs=javascript#sign-in-with-redirect,您需要注册一个回调函数,以便访问/处理令牌。
重定向方法不返回承诺,因为移离主应用程序。要处理和访问返回的令牌,您需要在调用重定向方法之前注册成功和错误回调。
function authCallback(error, response) {
//handle redirect response
}
myMsal.handleRedirectCallback(authCallback);我想这个标记可能在某个地方的反应中。
https://stackoverflow.com/questions/62451465
复制相似问题