Hasan Alp Zengin
Hasan Alp Zengin

Reputation: 99

Azure AD No User Authentication in Spring Boot

I want to login to my application with the use of https://login.microsoftonline.com/{tenant}/oauth2/token endpoint. I'm filling parameters(client_id, client_secret, resource and grant_type:client_credentials) in post request and getting access token. When I use it to login my API spring boot gives me error:

com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS50058: A silent sign-in request was sent but no user is signed in.

What should I do to get valid bearer token with only post request ? Or is there any azure configuration I am missing to ?

Upvotes: 0

Views: 1110

Answers (1)

Marc
Marc

Reputation: 1041

What you describe as 'login' is not a user login but an application request for an access token. The application can then use this token to call some other API, e.g. MS Graph. It is intended for use by applications where either there is no user involved at all (e.g. a daemon service) or the application wants to call an APIs without reference to the currently logged in user. If, what you want to do is to have a user signin to your application, you will need to use the OpenIDConnect Authorization Code Grant flow. Use MSAL4J.

Upvotes: 1

Related Questions