Azure-Samples / Azure-Samples/ms-identity-msal-java-samples
Issue requesting for a new token using refresh token
- Lenguaje dominante
- Java
- Estrellas
- 79
- Forks
- 82
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
No se nombran archivos ni pruebas del repositorio; empieza por rastrear el flujo del refresh token del cliente Spring OAuth2 y la solicitud a Azure AD v2 /token descrita en los logs. Compara el registro de la aplicación y la configuración del cliente con la solicitud que falla y, a continuación, verifica que un access token caducado se pueda renovar correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, azure, java, spring
- Área
- authentication, backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100