【发布时间】:2018-02-16 10:24:46
【问题描述】:
我有一个应用程序,它使用 adal-angular 从 Azure 广告获取不记名令牌。 我可以向 graph-api 提问以使用该令牌获取我想要的数据。 但现在我想更改该数据。为此,我需要一个来自 azure AD 的应用令牌。 图 api 资源为https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/educationschool_update
我的应用是一个使用 adal-angular 的 React 应用。
我的应用有一个秘密可以做到这一点。 我的问题是,Adal -angular 可以给我这个应用令牌吗?如果可能的话,它怎么能做到这一点? 下面是我对 adal 角度的配置。 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;
}
【问题讨论】:
标签: reactjs