Stuck with Oauth2 V3 API

Occasional Visitor

Stuck with Oauth2 V3 API

Using Rails and Oauth2, I am running into an error that says: "{"error_description":"Invalid client or client credentials","error":"invalid_client"}"


What is strange that I'm able to generate the initial URL:


Takes me to the "XXX is requesting permission for the following: etc..." I see the name of the APP I created which leads me to think that the client id I am passing is correct.


I created my own strategy based off this:


I specified the following:


option :client_options, {
site: '',
token_url: '',
authorize_url: '',
grant_type: "authorization_code"

Any ideas on where to look? 



Re: Stuck with Oauth2 V3 API

Hello @JamesC400,


Thank you for reaching out to Constant Contact's API Support.


That error means one of two things. Either the API Key you are using in invalid; which doesn't seem likely since you are able to generate your authorization code, or the authorization header you are using was not generated correctly.


In Steps 4 and 5 of the oAuth flow you need to include an authorization header that uses a Basic token and the way you generate that is by putting your api_key and client_secret together separated by a : (colon). Then base64 encoding that.


Here is an example of how the header would look if I were to be submitting a cURL command and encoded api_key:client_secret.


header 'Authorization: Basic YXBpX2tleTpjbGllbnRfc2VjcmV0'

Jimmy D.
Tier II API Support Engineer
Occasional Visitor

Re: Stuck with Oauth2 V3 API


Thanks for the response! You led me in the right direction. Turns out there was a typo while constructing the Authorization header on my end. 


thanks a lot!

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More