Question
· Mar 12

Get JWT Token

Hi Guys,

I'm trying both of these methods to get a JWT token but none is working for some reason and not sure what I'm missing?

it works when I tested it from Postman 

Thanks

Product version: Ensemble 2018.1
Discussion (12)3
Log in or sign up to continue

If it's null, your code might not even be getting to the Post method. Are you running this in the terminal, and are you getting any other errors there? Is your RTLS SSL configuration set up in the management portal?

Also, when the response comes back, it's JSON, so if you want to get just the token, you'd have to:

set tokenObj = ##class(%Library.DynamicObject).%FromJSON(AuthToken.HttpResponse.Data)
set AuthTokenValue = tokenObj.%Get("access_token")

I believe you have to post excluding the domain name in the URL (As you already specified domain under Server property of HttpRequest object).  From your terminal screenshot , try like below ?

set tSc=AuthToken.Post("/B2C_1A_client_credentials_signIn/oauth2/v2.0/token?ptid=.........")