question

Adrienne Giles avatar image
Adrienne Giles asked Phong Vu answered

Password Authentication error OAU - 149

I am using Java and trying to retrieve Call Log Records. trying to get a token for the call

https://platform.devtest.ringcentral.com/restapi/v1.0/account/@account/extension/@extension/message-store

Unirest.post(AuthURL);

rs.header("accept", "application/json");

rs.header("Content-Type", "application/x-www-form-urlencoded");

rs.header("Authorization", "Basic "+ClientId+ClientSecret );

parameters :

Map<String,Object> m = new HashMap<String,Object>();

m.put("grant_type", "password");

m.put("username", xxxxxx);

m.put("extension", "xxx");

m.put("password", xxxxxx);


when executed get { "errorCode" : "TokenInvalid", "message" : "Invalid token", "errors" : [ { "errorCode" : "OAU-149", "message" : "Invalid token" } ] }



Can anyone tell me the correct syntext to use for the authorization?

application https://platform.devtest.ringcentral.com/

settings as above. using the "try it" apps all works .

authentication
1579888322645.png (26.6 KiB)
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

Since you are using password flow. the API to get the token is as follows:

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

Header:

Content-Type: application/x-www-form-urlencoded

Authorization: Basic <Base64 of clientid:client secret>

Body parameter :

username=<user name>&password=<password>&extension=<extension>&grant_type=password

Please note: Here in the header Authorization will be Base64 encoding of clientid:client secret

rs.header("Authorization", "Basic "+Base64 of ClientId+":"+ ClientSecret ); 


1 |3000

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

Arjun k avatar image
Arjun k answered

Please refer the below screen shot.


1580041856032.png (175.4 KiB)
1 |3000

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

Khadhar Koneti avatar image
Khadhar Koneti answered
1 |3000

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

Phong Vu avatar image
Phong Vu answered

Is there any reason why you cannot use the official RingCentral Java SDK. It would save you lots of time.

See this dev guide on how to work with the message store.

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