Azure-Samples / Azure-Samples/ms-identity-msal-java-samples

Issue requesting for a new token using refresh token

オープン
#43 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
untriaged
主要言語
Java
スター
79
フォーク
82
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi,

I am using a springoauth2client library-based BFF application for authenticating my Angular app using Azure AD.
I have registered my application as a web App in Azure with a custom scope and the login works fine. When I add offline_access to the scope, I am also able to get the refresh token.
But the problem is when the access token expires and the spring oauth2 client tries to use the refresh token to fetch a new Auth token, the request fails with the following error :

[2023-09-27 16:09:51.080][sessionId][DEBUG ][org.springframework.web.client.RestTemplate.debug:127] - HTTP POST https://login.microsoftonline.com/XXXXX/oauth2/v2.0/token
[2023-09-27 16:09:51.080][sessionId][DEBUG ][org.springframework.web.client.RestTemplate.debug:127] - Accept=[application/json, application/*+json]
[2023-09-27 16:09:51.080][sessionId][DEBUG ][org.springframework.web.client.RestTemplate.debug:127] - Writing [{grant_type=[refresh_token], refresh_token=[0.AQcAg6oJq3Rv5LljkljljljRRRRRRRqvwndcQHSI]}] as "application/x-www-form-urlencoded;charset=UTF-8"
[2023-09-27 16:09:51.080][sessionId][DEBUG ][org.springframework.web.client.RestTemplate.debug:127] - Response 400 BAD_REQUEST [invalid_request] AADSTS90009: Application 'XXX'(XXXX) is requesting a token for itself. This scenario is supported only if resource is specified using the GUID based App Identifier.

Please let me know what needs to be changed. I am assuming I am missing something during App Registeration since this is a federated client and I am not facing any such issue with other Identity Providers

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

リポジトリのファイルやテストは指定されていません。まず、Spring OAuth2 クライアントの refresh token フローと、ログに記載されている Azure AD v2 /token リクエストを追跡します。アプリケーション登録およびクライアント設定を失敗しているリクエストと比較し、その後、期限切れの access token を正常に更新できることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, azure, java, spring
領域
authentication, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。