question

benjamin-dean avatar image
benjamin-dean asked ·

How does OAuth work as far as getting the token and refreshing of the token in my code?

Saw this question being asked in an email thread and thought I would share it for anyone who may have the same question...

How does OAuth work as far as getting the token and refreshing of the token in my code?
Does my app need to request a new token after a period of time?

oauth2tokenaccessrefresh
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
Our APIs use  Oauth 2.0 Protocol for authentication and authorization. Once the app is authenticated our servers return back the access token and refresh token which are valid for 1 hour and 1 week respectively. You are able to cache the tokens and use them to request new access/refresh tokens after they are expire. We provide different authorization flows for a client application :
  • Authorization Code Flow ( recommended for Client/Browser Applications )
  • Resource Owner Password Credentials Flow (ROPC)
  • Refresh Token Flow
More information on Authorization Flows could be found here :  https://developer.ringcentral.com/api-docs/latest/index.html#!#AuthorizationFlows.html
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

sahiba-singh avatar image
sahiba-singh answered ·
Thanks for share.This link may everyone know.It is better if you share the parameter,you passed in api to get the refresh token.

Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary answered ·

The parameter for refresh_token is almost same as grant_type password with minor change.

url will be same: https://platform.devtest.ringcentral.com/restapi/oauth/token

Headers:

"Accept":"application/json“
"Content-Type":"application/x-www-form-urlencoded“
"Authorization",:"Basic <ClientID:ClientSecret in base 64> 

Body:

In body, we need to pass the parameters in following way :

username=<account phone number>&password=<account password>&extension=<your extension>&grant_type=refresh_token&refresh_token=<the refresh token generated>
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.