【问题标题】:How to configure Azure AD to enable refresh tokens如何配置 Azure AD 以启用刷新令牌
【发布时间】:2016-04-22 23:58:04
【问题描述】:

我有一个链接到 Azure AD 的 Azure 应用服务/Web API,并且身份验证正在运行,但是客户端令牌将在 1 小时后过期,因此我想启用 OAuth refresh_token。当我检查在我的服务上调用 /.auth/me 的结果时,我没有看到 refresh_token。应用服务上启用了令牌存储。

我已尝试将其添加到 Azure AD 清单中的 oauth2permissions,如下所示,但它没有出现(我已重新启动 App 服务并重新部署我的服务以防缓存令牌):

"oauth2Permissions": [ 
    {
        "adminConsentDescription": "Allow the application to store a refresh token on behalf of the signed-in user.",
        "adminConsentDisplayName": "Refresh tokens",
        "id": "3AGH4D29-B64A-4A9A-8DBC-5DB3C8BBBD75",
        "isEnabled": true,
        "type": "User",
        "userConsentDescription": "Allow the application to store a refresh token on your behalf.",
        "userConsentDisplayName": "Store refresh token",
        "value": "refresh_token"
    }
]

我的尝试基于此处给出的指导: https://cgillum.tech/2016/03/07/app-service-token-store/

【问题讨论】:

  • 您是否在使用某个库(例如 ADAL.Net)?请参阅 Vittorio 的这篇博文:cloudidentity.com/blog/2015/08/13/…
  • @GauravMantri 这很有趣,谢谢,它给了我一些思考。可能是客户端没有请求令牌。我正在使用 Azure 移动服务客户端 sdk 进行身份验证。目前我正在使用 MobileServiceClient.LoginAsync() 方法,这可能是对 ADAL 的抽象,我将不得不对其进行研究。我已经看到很多“手动”身份验证的示例,这可能使我能够控制请求 refresh_token。

标签: azure azure-web-app-service azure-active-directory azure-app-service-envrmnt


【解决方案1】:

我使用此处的指导解决了这个问题:https://cgillum.tech/2016/03/25/app-service-auth-aad-graph-api/

基本上,您必须更新应用服务的身份验证设置。而且它没有 UI,所以我使用了 azure 资源浏览器。

关键是将 AdditionalLoginParams 值设置为 ["response_type=code id_token", "resource=https://graph.windows.net"]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-17
    • 2021-12-26
    • 2018-01-08
    • 2019-08-31
    • 1970-01-01
    • 2016-12-21
    • 2018-01-21
    • 2018-12-20
    相关资源
    最近更新 更多