Skip to main content

Hello!

I’m trying to implement an integration, and I’m stuck on the Connection label (meaning, it doesn’t show up necessary information).

 

I’d like to extract data from JWT token I receive from OAuth provider and use it as the Connection label, but I found no documentation on this subject. Is it actually possible?

 

I think, requesting user additional information, in order to put it into the label, is clumsy, especially when we have params in tokens.

Best regards,

Alexander Mustafin

@sashker - Assuming the token is stored in authData.access_token and the connection label is set to {{username}} , try using the code snippet below in the authentication test function to parse the JWT token:

function parseJwt(token) {
const payload = Buffer.from(token.split(".")t1], "base64");
return JSON.parse(payload);
}

const userData = parseJwt(bundle.authDatat"access_token"]) // Assuming the token is stored in `access_token`. Calling this function would parse the token

return {
username: userData.username
}