Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
iztoogood
Contributor III
Contributor III

Any easy way to generate a JWT token to request an external web API ?

I'm looking for a simple way to generate au jwt token using HS256 (hmac sha256)

I have tried to deal with it using https://github.com/auth0/java-jwt in a routine ... with no success...

I have found this other code https://github.com/Talend/components/blob/master/core/components-common-oauth/src/main/java/org/talend/components/common/oauth/Jwt.java ... but i dont't know waht to do with it ...

my need is not link to salesforce APIs

I do not speak java ...

I know how to build the json header and payload ...

I have to create the jwt token liek this

aaaaa.bbbbb.ccccc

with the API key and the API secret i have...

Any help is welcome

Labels (4)
2 Replies
iztoogood
Contributor III
Contributor III
Author

I manage to generate the jwt token via a tSystem that load a smal python script with PyJWT...

I would prefer staying in talend...

for now it works...

Anonymous
Not applicable

Hello,

You can use a java library like https://github.com/auth0/java-jwt that can read, create a verifier and validate the JWT and just need to get the good key for each issuer (auth0/talend)

Here are two examples

Auth0 jwks uri example: https://login.int.cloud.talend.com/.well-known/jwks.json

Talend jwks uri example: https://iam.int.cloud.talend.com/oidc/jwk/keys

Or

Use spring security feature to read and validate the JWT.

Custom code must be added to handle auth0/ talend JWT

see:

https://auth0.com/docs/quickstart/backend/java-spring-security5/01-authorization

https://dzone.com/articles/use-both-jwt-and-opaque-access-tokens-with-spring

 

Feel free to create a workitem jira issue on talend bug tracker.

Best regards

Sabrina