我有一个应用程序,通过adal-angular从Azure广告获取持有人令牌。我可以向graph-api提问,以获得我想要的数据。但现在我想改变这些数据。为此我需要来自azure AD的app令牌。图api资源是https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/educationschool_update
我的应用是一个使用adal-angular的React应用。
我的应用程序有秘密可以做到这一点。我的问题是,Adal -angular可以给我这个应用程序令牌吗?如果它可能,它怎么能这样做?下面是我对adal angular的配置。 client_secret就是我想要开始工作的东西..
window.authContext = new AuthContext({
tenant: 'xxxxx',
clientId: 'xxxx',
redirectUri: "http://localhost:3000/",
client_secret : 'APP SECRET HERE!?!?!?!?!?!?',
cacheLocation: 'localStorage'
});
这是我为登录人员获取令牌的方法。
aquireToken() {
let header = null;
window.authContext.acquireToken('https://graph.microsoft.com', (error, token) => {
header = {
headers: {
Authorization: 'Bearer ' + token
}
}
});
return header;
}
我认为从Web客户端(浏览器中加载的UI)是不可能的,因为根据Azure AD CORS策略,只有Authorize端点对Web客户端开放,您无法将client_secret发送到Authorize端点。根据文档没有这样的参数:https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code
我希望它有所帮助,即使它在询问后6个月来:)