Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect_uri_mismatch during Access Token Request #9

Open
kpheasey opened this issue Sep 18, 2020 · 1 comment
Open

redirect_uri_mismatch during Access Token Request #9

kpheasey opened this issue Sep 18, 2020 · 1 comment

Comments

@kpheasey
Copy link

I'm running into a problem where I get a redirect_uri_mismatch error during the callback phase, after granting access on CC. CC is redirecting back to my development server, but when we can't get an access token.

Constant Contact app settings:
Redirect URI: http://localhost:5000/companies/auth/constantcontact/callback
Callback URL: http://localhost:5000/companies/auth/constantcontact/callback

12:49:38 web.1     | Started GET "/companies/auth/constantcontact" for 127.0.0.1 at 2020-09-18 12:49:38 -0400
12:49:38 web.1     | I, [2020-09-18T12:49:38.462547 #37780]  INFO -- omniauth: (constantcontact) Request phase initiated.
12:49:48 web.1     | Started GET "/companies/auth/constantcontact/callback?code=123&state=456&username=kevin%40kpsoftware.io" for 127.0.0.1 at 2020-09-18 12:49:48 -0400
12:49:48 web.1     | I, [2020-09-18T12:49:48.692383 #37780]  INFO -- omniauth: (constantcontact) Callback phase initiated.
12:49:48 web.1     | E, [2020-09-18T12:49:48.818707 #37780] ERROR -- omniauth: (constantcontact) Authentication failure! invalid_credentials: OAuth2::Error, redirect_uri_mismatch: Redirect URI mismatch.
12:49:48 web.1     | {
12:49:48 web.1     |   "error": "redirect_uri_mismatch",
12:49:48 web.1     |   "error_description": "Redirect URI mismatch."
12:49:48 web.1     | }
12:49:48 web.1     | Processing by OmniauthCallbacksController#failure as HTML
12:49:48 web.1     |   Parameters: {"code"=>"123", "state"=>"456", "username"=>"[email protected]"}
12:49:48 web.1     | Redirected to http://localhost:5000/credentials
12:49:48 web.1     | Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 294)

I found a very old support article where someone had the same issue. However, their solution description is a bit cryptic. https://community.constantcontact.com/t5/Developer-Support-ask-questions/Redirect-URI-mismatch-Access-Token-Request/m-p/98467

@borovyi
Copy link

borovyi commented Sep 10, 2021

@kpheasey I got the same issue. You just need to redefine callback_url - omniauth/omniauth-oauth2#93 (comment)
In my case it looks like this:

# omniauth.rb

module OmniAuthExtensions
  def callback_url
    full_host + script_name + callback_path
  end
end

OmniAuth::Strategies::ConstantContact2.include OmniAuthExtensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants