{"id":4748,"date":"2019-03-04T04:07:39","date_gmt":"2019-03-04T04:07:39","guid":{"rendered":"http:\/\/blogs.aaddevsup.xyz\/?p=4748"},"modified":"2021-03-25T23:14:24","modified_gmt":"2021-03-25T23:14:24","slug":"using-jwt-io-to-verify-the-signature-of-a-jwt-token","status":"publish","type":"post","link":"https:\/\/blogs.aaddevsup.xyz\/2019\/03\/using-jwt-io-to-verify-the-signature-of-a-jwt-token\/","title":{"rendered":"Using jwt.io to verify the signature of a JWT token"},"content":{"rendered":"
In an asymmetric algorithm, a JWT token is signed with an Identity Provider’s private key. To verify the signature of the token, one will need to have a matching public key. This post will cover how to use the JWT tool at https:\/\/jwt.io\/<\/a> to verify the signature of an signed Azure AD token (either access or id token).<\/p>\n Note:<\/strong><\/span><\/p>\n <\/p>\n Scrolling down a little you will see the version of the token (v1 token in this case) and it will say “invalid signature”. This is expected since at this point we have not provided any certificate info for the tool to verify the token signature.<\/p>\n <\/p>\n<\/li>\n V1 token<\/a>: https:\/\/login.microsoftonline.com\/{tenant name}<\/span>\/.well-known\/openid-configuration<\/p>\n V2 token<\/a>: https:\/\/login.microsoftonline.com\/{tenant name}<\/span>\/v2.0\/.well-known\/openid-configuration<\/p>\n For my case, I use the V1 OIDC endpoint. You can either paste the URL into a web browser or postman to find the “jwks_uri” field from the response:<\/p>\n <\/p>\n<\/li>\n <\/p>\n<\/li>\n \u2011\u2011\u2011\u2011\u2011BEGIN CERTIFICATE\u2011\u2011\u2011\u2011\u2011<\/p>\n MIIDBTCCAe2gAwIBAgIQKOfEJNDyDplBSXKYcM6UcjANBgkqhkiG9w0BAQsFADAtMSswKQYDVQQDEyJhY2NvdW50cy5hY2Nlc3Njb250cm9sLndpbmRvd3MubmV0MB4XDTE4MTIyMjAwMDAwMFoXDTIwMTIyMjAwMDAwMFowLTErMCkGA1UEAxMiYWNjb3VudHMuYWNjZXNzY29udHJvbC53aW5kb3dzLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK8ZT56lunzbgm3a4QxM8BiVbsd4j77bf\/K\/rhxyCmuwv2\/7seYXsDTEvdUoFD2Tq7Km+eLh4\/+yDViqihLRXOGD\/NxYbLP7jv5k\/e3MxDbOM1mkjfRMMPxc9+sav7meue+dJRysF0CdQP6XvlToDZT4PBAou5nkAydOa\/N\/HrtY6ShY8ZEK3URUy4GLUUO08V\/s80cqEUfIqiXOkb54o4dffmH1rQbAiNa9du0hWpFAa2P2SrCshPSjVlC+x+uRMhUTYCvNF32L4UJRsN\/gI39vH4u9cFvgcqStW0wgK88F+84Bdx+j9bvDyqLEjkjf0PfkHPV\/kf2Pt2zqTiIizr8CAwEAAaMhMB8wHQYDVR0OBBYEFC\/\/HOy7pEIKtnpMj4bEMA3oJ39uMA0GCSqGSIb3DQEBCwUAA4IBAQAIYxZXIpwUX8HjSKWUMiyQEn0gRizAyqQhC5wdWOFCBIZPJs8efOkGTsBg\/hA+X1fvN6htcBbJRfFfDlP\/LkLIVNv2zX4clGM20YhY8FQQh9FWs5qchlnP4lSk7UmScxgT3a6FG3OcLToukNoK722Om2yQ1ayWtn9K82hvZl5L3P8zYaG1gbHPGW5VlNXds60jIpcSWLdU2hacYmwz4pPQyvNOW68aK\/Y\/tWrJ3DKrf1feDbmm7O5kpWVYWRpah+i6ePjELNkc2Jr+2DchBQTIh9Fxe8sz+9iOyLh9tubMJ+7RTs\/ksK0sQ1NVScGFxK+o5hFOOMK7y\/F5r467jHez<\/p>\n \u2011\u2011\u2011\u2011\u2011END CERTIFICATE\u2011\u2011\u2011\u2011\u2011<\/p>\n<\/li>\n <\/p>\n The above steps show a manual way to validate the JWT token’s signature given the certificate’s public key.<\/p>\n\n
Verifying the token signature<\/h1>\n
\n
\u00a0<\/h1>\n
Conclusion:<\/h1>\n
References:<\/h1>\n