两个具有不同access_token格式的相同的Azure应用程序 - 一个JWT,另一个非JWT

发布于 2025-01-30 09:51:17 字数 593 浏览 2 评论 0原文

访问/.auth/me时,一个应用程序具有正确的JWT格式的access_token,但在另一个应用程序中,它不采用JWT格式。

这是有效的jwt One:eyj0exaioijkv1qilcju ... eyjhdwqioijodhrwczov ... b84ciskwf2oore5n

这是非jwt One:paqabaaaaaaaaaaaaaaaaad--dla3vo7qrddgjrddgjjgjgjgjgjgjjgjjgjjgjjg7wwwrtrtsy Apply Apply and Apply Apply and Apply and Apply and wity

wayerty to y/appsy and wity to y/appsy to y/完全相同的。

知道如何修复第二个应用程序也显示JWT访问令牌吗?

When accessing /.auth/me, one app has the access_token in the correct JWT format, but in the other app it's not in JWT format.

This is the valid JWT one: eyJ0eXAiOiJKV1QiLCJu...eyJhdWQiOiJodHRwczov...B84ciSKwF2oOre5n

This is the non-JWT one: PAQABAAAAAAD--DLA3VO7QrddgJg7WevrTLy

The configuration for both apps appear to be identical.

Any idea how to fix the second app to also show JWT access token?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2025-02-06 09:51:17
  • 通常情况
    作为参数之一,访问令牌没有形式(
    JSON Web令牌)JWT令牌令牌格式。
  • 请尝试将资源与您的应用ID URI或
    您的应用程序需要的资源。要找到应用程序ID UI,在
    Azure门户网站,单击Azure Active目录,单击应用程序
    注册,单击服务应用程序,然后单击设置
    和属性。
  • 还将在请求中设置 客户端和客户端秘密

在其他情况下,仅用于访问应用程序服务,您可以使用id_token bearer 作为授权标题中的响应_type作为授权:bearer“ {your-id-id-token}”。

参考: oauth 2.0授予凭据,访问令牌请求| Microsoft Docs

您可以使用 azure Resource Explorer 编辑App Service Auth的属性如果尚未包括在内的资源。请参阅资源提供者和类型<< /a>

要获取访问令牌,请尝试使用Azure Resource Explorer设置资源。

  1. 从应用程序服务导航到资源资源管理器。
  2. 转到config&gt;验证设置,然后单击编辑。

使用[资源的resource =&lt; name/id'']更新AddalloginParams,然后单击put。

例如:

“additionalLoginParams”: [
“resource=https://graph.microsoft.com ”
]

然后通过保存更改并刷新应用程序服务,重试,检查访问令牌的值是否以JWT令牌的形式进行。

  • Usually when the authentication flow configuration has not included resource
    as one of the parameter, the access token does not have form of a (
    JSON Web Token)JWT token token format.
  • Please try to include resource with your application Id Uri or
    resource that your application requires . To find the App ID URI, in
    the Azure portal, click Azure Active Directory, click App
    registrations, click the service application, and then click Settings
    and Properties.
  • Also set the clientId and client secret in the request.

In other cases just to access the app service you could use id_token or Bearer as response_type in authorization header as Authorization:Bearer "{your-id-token}".

Reference:Oauth 2.0 grant credentials ,Access token request | Microsoft Docs

You can make use of azure resource explorer to edit the properties of the app service auth to include the resource if not already included. See resource provider and types

To get an access token, please try to set the resource using the Azure Resource Explorer.

  1. Navigate to the Resource Explorer from the App Service.
  2. Go to config > authsettings and click on Edit.

Update the additionalLoginParams with ["resource=<Name/ID of the resource>"] and click on PUT.

For example:

“additionalLoginParams”: [
“resource=https://graph.microsoft.com ”
]

Then by saving changes and refreshing the App Service, try again and check that the value for the access token is in the form of a JWT token or not.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文