question

benjamin-dean avatar image
benjamin-dean asked Anirban answered

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?

getting started
1 |3000

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
1 |3000

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

sahiba-singh8943 avatar image
sahiba-singh8943 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.

1 |3000

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

Anirban avatar image
Anirban 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>
1 |3000

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

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys