Question

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

  • 13 April 2016
  • 3 replies
  • 3693 views

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?


3 replies

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

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>

Reply