...
After completing the onboarding, you will have received a
JSON
file namedaccount_info.json
.
Structure ofaccount_info.json
PEM
Format KeyCode Block language json { "keyId": "123e4567-e89b-12d3-a456-556642440000", "issuer": "NEW_PARTNER", "privateKey": "-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgevZzL1gdAFr88hb2\nOF/2NxApJCzGCEDdfSp6VQO30hyhRANCAAQRWz+jn65BtOMvdyHKcvjBeBSDZH2r\n1RTwjmYSi9R/zpBnuQ4EiMnCqfMPWiZqB4QdbAd0E7oH50VpuZ1P087G\n-----END PRIVATE KEY-----", "publicKey": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEVs/o5+uQbTjL3chynL4wXgUg2R9\nq9UU8I5mEovUf86QZ7kOBIjJwqnzD1omageEHWwHdBO6B+dFabmdT9POxg==\n-----END PUBLIC KEY-----" }
Using any standard
JWT
library in the language of your choice, you can create aJWT
with a header and payload like the following example:Code Block language json { "alg": "ES256", "typ": "JWT", "kid": "123e4567-e89b-12d3-a456-556642440000" } { "iss": "NEW_PARTNER", "iat": 1511900000, "exp": 1511903600 }
Please set
alg
(Algorithm) asES256
For the
kid
(Key ID) field in the header, specify the value corresponding to thekeyId
field of youraccount_info.json
file.For the
iss
(Issuer) field, specify the value corresponding to theissuer
field of youraccount_info.json
file.For the
iat
(Issued At) field, specify the Unix time when the token was issued.For the
exp
(Expiration Time) field, specify the Unix time denoting when the token will expire. The tokens will be rejected if the validity(i.e.exp
-iat
) of the token is more than 1hr.
Sign the
JWT
with the private key (i.e. value corresponding to theprivateKey
field of youraccount_info.json
file).
Note |
---|
Protect the privacy of your private key and signed tokens Your private key ( Never share signed JWTs with third parties. |
Examples
Java
- Using auth0/java-jwtCode Block language java PrivateKey privateKey = //Get the private key instance Algorithm algorithm = Algorithm.ES256(null, privateKey); String signedJwt = JWT.create() .withKeyId(keyId) // `kid` .withIssuer("NEW_PARTNER") // `iss` .withIssuedAt(new Date(now)) // `iat` .withExpiresAt(new Date(now + 3600 * 1000L)) // `exp` .sign(algorithm);
...