JPsOneSpan

Any Java SDK code examples for OAuth 2.0/JWT?

0 votes

Is 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.

Regards,

Jianping Xu (J.P.)

Bonterra (formerly, CyberGrants)


Approved Answer

Reply to: Any Java SDK code examples for OAuth 2.0/JWT?

1 votes

Hi 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

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Any Java SDK code examples for OAuth 2.0/JWT?

0 votes

Thank you Duo! Will try it.

Regards,

Jianping Xu (J.P.)

Bonterra (formerly, CyberGrants)


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off