I am trying to consume a web service. I need to get the token and send this token in the authorization header, I am getting the token but in the server there is a problem because the token is v1 and they are working with v2.
This is the url I am using to get the code
and this the url to get the token
https://login.microsoftonline.com/tenant/oauth2/v2.0/token with the code of the first callout in the authorization header.
This callout return a token, but when I send the token to the ws I need to consume I get an error and when asked about the error they told me that the token I am sending is v1 and is needs to be v2.
This is my token iss iss: "https://sts.windows.net/tenant/
But needs to be: iss: "https://login.microsoftonline.com/tenant/v2.0
The error on my site is:
Status=Unauthorized, StatusCode=401 Bearer error="invalid_token", error_description="The signature is invalid"
And in the server is:
Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler(Information): Bearer was not authenticated.
Do you have any work around to get the v2 token.