question

01525690 avatar image
0 Votes"
01525690 asked ShwetaMathur commented

Validate access_token signature in php

Hello,

How can I verify the signature of the token in php laravel.

azure-active-directoryazure-ad-b2cazure-ad-single-sign-on
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@01525690,
Just checking in to see if the below answer helped. If this answers your query, please don’t forget to click "Accept the answer" and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

0 Votes 0 ·

Hi @01525690,

Just checking in to see if the below answer helped. If this answers your query, please don’t forget to click "Accept the answer" and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
Thanks,
Shweta


0 Votes 0 ·

1 Answer

ShwetaMathur avatar image
0 Votes"
ShwetaMathur answered

Hi @ 01525690,

Thanks for reaching out.

Access tokens are signed using RS256 which would mean that the JWT is signed with Azure AD private key and would be validated by Azure AD public key.

Once you will get the access token using token endpoint, token need to verify to validate the authenticity of the JWT token’s data is by using Azure AD’s public key to verify the signature. You can obtain public key by calling the public Azure AD OpenID configuration endpoint https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration and verify against the private key(kid) generated by Azure AD token.

I am not sure about how to implement in PHP but found a stack overflow thread to verify JWT using PHP.

Hope this will help.

Thanks,
Shweta


Please remember to "Accept Answer" if answer helped you.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.