【问题标题】:Adal-angular app token with secret带有秘密的 Adal-angular 应用令牌
【发布时间】: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


    【解决方案1】:

    我认为从 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 个月后有帮助:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-03
      • 2012-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多