question

Richard Campbell avatar image
Richard Campbell asked ·

OAuth2 Getting Invalid Client ID

When using the RC dev OAuth server I get "Invalid Client_ID" when I try to authenticate.

I am using the Client ID from my app

Do I need to encode this in anyway? If so how would I encode this in Python 3 lets say?

I have tried using base64 lib with no luck

authentication
1 |1500 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 avatar image
Anirban answered ·

Yes for getting token you need to encode both client Id and client secret in base64 format in Authorization header in normal API call as follows:

Authorization: Basic <clientId:client secret in base64>

Here are several examples of how to use Authorization Flow in a variety of languages: https://github.com/grokify/ringcentral-demos-oauth

Also oauth url should be http POST

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

Richard Campbell avatar image
Richard Campbell answered ·

Are the < and > needed?

I am creating a http get and passing the Client_ID parameter

What is the exact string I need to encode for the parameter in my get?


Client_ID =base64encode("Authorization: Basic <clientId:client secret>")



1 comment
1 |1500 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.

Basic client I'd: client secret (client Id: client secret with colon in base64)

0 Likes 0 ·
Anirban avatar image
Anirban answered ·

Header should be named Authorization and the value will be :

Basic client id: client secret ( here client I'd +client secret value with colon in base64 )

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

Richard Campbell avatar image
Richard Campbell answered ·

should I follow:

https://developers.ringcentral.com/api-reference/Authorization


Do I need any params (i.e. client_id, response_type, redirect_uri, brand_id, state, prompt) or is the "Authorization" : "Basic base64encode(client-ID:client-secret)" header only needed?


1 |1500 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 avatar image
Anirban answered ·

Yes you need to pass the parameters as well . But check which type of Authorization your application follows.. is it Authorization code or password flow.. based on that the parameters and oauth url will change

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

Richard Campbell avatar image
Richard Campbell answered ·

I am trying to use the Python API

https://github.com/ringcentral/ringcentral-python

Any pointers here - I do see an internal function for this purpose Platform._request_token but haven't been able to get it to work

I am using Authorization code

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

Richard Campbell avatar image
Richard Campbell answered ·

So it turns out I had a typo in the Client ID and now I am past this error.


I do have one followup question. Where do I get the "Application code grant" code to put into the post?


Does the /restapi/oauth URI on the dev portal have the ability to provide this?

1 |1500 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 avatar image
Anirban answered ·
1 |1500 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.