1. Marcin Jurkowski
  2. PowerBuilder
  3. Friday, 8 April 2022 12:12 PM UTC

Hello,

I just want to know if there is any special reason for GetJWTToken function if it's doing (almost) exactly the same as SendPostRequest.

I see that GetJWTToken has extra return status:  "-5 -- Failed to get token" (and has SendPostRequest "-10 -- The token is invalid or has expired") but in general they are doing the same and I need to extract token from the response json.

Q2. "-5 -- Failed to get token" - when can I except this status?

Regards,
Marcin

Accepted Answer
Kai Zhao @Appeon Accepted Answer Pending Moderation
  1. Monday, 11 April 2022 07:23 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Marcin,

Both SendPostRequest and GetJWTToken send the HTTP POST request to the server, and they need to extract token from the response json. Providing SetJWTToken & GetJWTToken and example code are mainly for users to access JWT Token.

For SendPostRequest returning -10:
After user sets the JWT token string to the HTTP request header, when SendPostRequest sends a request but the token is invalid or expired, it returns -10. Other interfaces have corresponding return values too, such as Submit, SendGetRequest. You can refer to the online documents for more information:
https://docs.appeon.com/pb2021/powerscript_reference/SetJWTToken_func.html

For GetJWTToken returning -5:
This is a mistake in the document, GetJWTToken does not return -5. For its return value, you can refer to SendPostRequest. In the meantime, we will correct the document.

Regards,
Kai

Comment
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.