Hi Mike
When you Base64urlDecode the header, you should get back the exact
string you passed including the /
so if i decode i get.
{"iss":"etc..","aud":"Google","typ":"google/payments/inapp/item/
v1",etc...
I am not using php so try it and see what is the php urlsafeB64Decode
is doing.
Here is my functions for decoding, check to see what you have
equivalent in your language library
{...............................................................................}
Function Base64urlEncoding ( Const Value: String ) : String;
Var
S : String;
Begin
S := EncodeBase64 ( Value );
S := replaceString ( S,'+','-' );
S := replaceString ( S,'/','_' );
Result := replaceString ( S, '=', '' );
End;
{...............................................................................}
Function Base64urlDecoding ( Const Value : String ) : String;
Var
S : String;
Begin
S := DecodeBase64 ( Value );
S := replaceString ( S,'-','+' );
S := replaceString ( S,'_','/' );
Result := S;
End;
{...............................................................................}
{...............................................................................}
Function DecodeJWT( EncodedJWT : String ) : String;
Var
JWTHeader, PayLoad, Signature : String;
SignedSignature : String;
S : String;
Begin
Result := '';
JWTHeader := Base64urlDecoding
( parseCh( EncodedJWT,'.'));
PayLoad := Base64urlDecoding
( parseCh( EncodedJWT,'.'));
Signature := EncodedJWT;
S := Base64urlEncoding ( JWTHeader ) + '.' +
Base64urlEncoding( PayLoad );
SignedSignature := Base64urlEncoding ( DCPHMAC_SHA256 ( S,
cJWTSecret ));
If SignedSignature = Signature Then
Result := PayLoad;
End;
{...............................................................................}