-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validating with Azure ad token #41
Comments
I would like to see a token, if you're able to provide one that is expired and does not contain any personal information or other sensitive data. |
It seems the original issue text's code wasn't formatted properly, but I get the idea of the code. Could you provide more information about the error that's being returned and on which line? The error's full text and Go type would be best. An example of a Go type would be |
I'm seeing a |
Could you link to where you read this?
|
Yes my error is "crypto/rsa: verification error" inside the parser file I have seen a large ticket on oidc here coreos/go-oidc#344 |
Currently, my best guess is that the key with the If this was also happening last, week, you may have experienced a different error at the time, but recreating that error would require a JWT signed with the newer key, meaning a JWT that was created today would need to be provided. The issue linked for If you are developing an application that uses OIDC, I would suggest using the As far as what you can do today, creating a new JWT now, then trying to parse & validate it would be the next step. That could show us if they key was rotated, but kept the same |
I just refreshed and the kid in my new token is 2ZQpJ3UpbjAYXYGaXEJl8lV0TOI I am getting the token by having the user log in through the front end and then querying MS for an access token. That token is then appended to the header for my API calls. The new token I just got has an expiry of Aug 08 2022 11:42:38 GMT-0230, seems the token is good for about 5 minutes, but it still returns the same error |
I found the issue. It seems I was sending the access token to my API and that was failing, however I changed my front end so it sends the ID token instead and that returns as valid. This can be closed. |
Wonderful. I'm glad you were able to resolve it. Hopefully next time someone has the same question, they'll find this. 🙂 |
I found this issue and was hitting the same, the answer is not to use the ID token, you shouldn't use the ID token as a bearer token when calling your API, you should only use the access token. The root of the problem is not adding a scope to the app registration in Azure AD, and requesting a token using that scope. See the docs here https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-expose-web-apis Without a custom scope, the audience of the access token will NOT be your application ID, instead it will be set to |
I am attempting to validate an Azure ad token with your package. It is able to parse the token but it fails to validate the signature. I have used several key URLs such as
https://login.microsoftonline.com/common/discovery/v2.0/keys
https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys
https://login.microsoftonline.com/{tenantid}/discovery/keys
https://login.microsoftonline.com/common/discovery/keys
https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys?appid={appid}
https://login.microsoftonline.com/{tenantid}/discovery/keys?appid={appid}
My parsing code is here:
`jwksURL := "https://login.microsoftonline.com/common/discovery/v2.0/keys"
if err != nil || !token.Valid {
return nil, errors.New("error validating token")
}
return claims, nil
`
Is there an issue with parsing Azure tokens, as I have read that the go-oidc project has seem some issues.
I can send you my token if you need it
Thanks
The text was updated successfully, but these errors were encountered: