I'm attempting to send an Auth0 JWT from my client to my server and have the token validated. I send the token_id returned from the auth0 authentication to my server via AuthHttp headers and i can obtain it without an issue within PHP.
Short and Simple:
- Angular 2 Auth0 JWT gets sent to the PHP server.
- How do i validate the signature is correct?
I have the Secret ID, i have the JWT helper class with the encode and decode.
How do i check the header and body = the signature of the JWT sent over, if that's even the correct way to do it.
Edit:
I pass in my token which is
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbG93aWUuZXUuYXV0aDAuY29tXC8iLCJzdWIiOiJnb29nbGUtb2F1dGgyfDEwNDY4ODk4NjgxNzEwNjQ3Mjc5MCIsImF1ZCI6IlYwWWVaREliYmVGdEJ4Z3F2UkNzVkFjWWxscXpaZGlNIiwiZXhwIjoxNDc4NzMxNjIzLCJpYXQiOjE0Nzg2OTU2MjN9._uyKrxJ0lPR-tEPjOFiI5ygeiM689gqURcIfG4sWkWc
In which i then get the body of this token and make it into an array
Array ( [iss] => https://lowie.eu.auth0.com/ [sub] => google-oauth2|104688986817106472790 [aud] => V0YeZDIbbeFtBxgqvRCsVAcYllqzZdiM [exp] => 1478731623 [iat] => 1478695623 )
Once i have the array, this is my payload right?
// Here's an image of the token being verified as right https://gyazo.com/93777863d988d8c6ef0fc4ea50755949
so why does the below code not give me the same token?
$jwt = JWT::encode($bodyArray, "SuperSecureSecretSecret");
yet i receive this back
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2xvd2llLmV1LmF1dGgwLmNvbS8iLCJzdWIiOiJnb29nbGUtb2F1dGgyfDEwNDY4ODk4NjgxNzEwNjQ3Mjc5MCIsImF1ZCI6IlYwWWVaREliYmVGdEJ4Z3F2UkNzVkFjWWxscXpaZGlNIiwiZXhwIjoxNDc4NzMxNjIzLCJpYXQiOjE0Nzg2OTU2MjN9.6lEg_0h0zytQZVBqDe-ZIS5PoSkFAJhWtRYSgaDCesY