Any Java SDK code examples for OAuth 2.0/JWT?
Friday, June 17, 2022 at 05:47amIs there a Java SDK code example to do OAuth 2.0 for creating an EslClient?
Right now I'm using clientAppId and clientAppSecret.
We'd like the initial authentication to return an access token and an expiration time and subsequent EslClient to be created using only the access token and expiration time.
Reply to: Any Java SDK code examples for OAuth 2.0/JWT?
Thursday, July 7, 2022 at 12:09pmHi Jianping,
Sorry for the late reply as I was on PTO last two weeks. In a nutshell, the SDK is ready requesting the access token and handing its lifecycle for you.
Below is the API behind the scene which requests the access token:
HTTP Request
POST /apitoken/clientApp/accessToken
HTTP Headers
Accept: application/json Content-Type: application/json
Request Payload
{ "clientId": "your_client_id", "secret": "your_client_secret", "type": "OWNER" }
Example Response
{ "accessToken": "17270a2f8960e84937478a60013404", "expiresAt": 1591029428203 }
And the EslClient would automatically cache the expiry date and request a new token 30 minutes before the expiry.
Duo
Reply to: Any Java SDK code examples for OAuth 2.0/JWT?
Thursday, July 7, 2022 at 12:16pmThank you Duo! Will try it.