Looking to sign the JWT with ECDSA (ES256) on Google Apps Script

Hi there! Thanks for this great threads of questions/answers.

Not sure if that’s possible, but I’m getting stuck on GAS with ECDSA signature because there is no native library… I’m using HMAC but Token remains false.

var header = {
"alg": "ES256",
"kid": "private",
"typ": "JWT"
};

var encodedHeader = Utilities.base64EncodeWebSafe(JSON.stringify(header));
      
var data = {
"iss": "private",
"exp": 1580425545,
"aud": "appstoreconnect-v1"
};

var encodedData = Utilities.base64EncodeWebSafe(JSON.stringify(data));
                           
var token = encodedHeader + "." + encodedData;

var secret = "private key"

var signature = Utilities.computeHmacSha256Signature(token, secret);
  
signature =  Utilities.base64EncodeWebSafe(signature);
  
var signedToken = token + "." + signature;

Thanks!

I think Auth0 support only HS256 and RS256 encription only.

1 Like

Yes, that is correct!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.