How do I correctly set up Omniauth + Devise + multiple providers - ruby-on-rails

My facebook authentication works. My twitter login however only works on localhost. My google does not work at all.
For google, I get the error:
400. That’s an error.
Error: redirect_uri_mismatch
The redirect URI in the request: http://unstarv.herokuapp.com/users/auth/google_oauth2/callback did not match a registered redirect URI.
For Twitter I get a similar problem in production on heroku though localhost works for Twitter login.
The Redirect URI I set up in both the twitter and google apps is :
http://unstarv.herokuapp.com
While the URLs I get after trying to log in these apps are:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXXXXXXXXXXXXXX
http://unstarv.herokuapp.com/users/auth/twitter/callback?oauth_token=XXXXXXXXXXXXXXXXXXXXX
Did I set up correctly my redirect & Callback URI s ? How come the Twitter login works on localhost but not on heroku ?
Thanks !!!

You shoud add this in your google console
http://unstarv.herokuapp.com/users/auth/google_oauth2/callback
While on Twitter I set
http://unstarv.herokuapp.com/ as a callback URL

Related

Getting login and redirect issues from Google

Trying to set up an Authentication for my app, and all seemed to be working correctly, but when I tried testing it out I got this error message
Authorization Error
Error 400: redirect_uri_mismatch
The redirect URI in the request, http://localhost:3000/api/auth/callback/google, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}
Can you point me in the right direction to fixing this?
Error 400: redirect_uri_mismatch
Is a configuration issue. The redirect uri is used to return the authorization code to your application after the user has consented to your applications access to your data. You have created a web client credentials up on Google developer console.
What you need to do is go back there and add a Redirect uri of
http://localhost:3000/api/auth/callback/google
It must match exactly don't add any spaces at the end or anything.
If you have any issues i have a video which will show you exactly how to add it Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
Seems like there's a mismatch with the Authorized redirect URIs. Are you sure you have entered the correct URIs? Redirect URI should be the URL that you'll be redirecting the user to after the login page or the base URL of your application Eg: https://localhost:8000
Also, make sure that you are using the correct Client ID and Client secret
Similar Questions
Google OAuth 2 authorization - Error: redirect_uri_mismatch
Correct redirect URI for Google API and OAuth 2.0

Facebook and Google Redirect URL are not HTTPS

https://www.example.com
I've installed SSL to my ASP.NET MVC 5 site, but the problem is the when I clicked Login with Facebook or Google the redirect url is not https
https://web.facebook.com/dialog/oauth?response_type=code&client_id=xxxx&redirect_uri=**http**%3A%2F%2Fwww.example.com%2Fsignin-facebook&scope&state=xxxxxx
this creates redirect mismatch bec i've registered the https version
how can i solve this?
This might help?
The redirect URI (where the response is returned to) has to be
registered in the APIs console, and the error is indicating that you
haven't done that, or haven't done it correctly.
Google OAuth 2 authorization - Error: redirect_uri_mismatch

Facebook OAuth Callback redirected to API not supported

I'm trying to register Users through my API using Facebook OAuth.
The problem is I keep getting this error:
The redirect_uri URL is not supported
the redirect_uri is:
redirect_uri=localhost%3A3000%2Fauth%2Ffacebook%2Fcallback
or, simplified:
localhost:3000/auth/facebook/callback
which is the URL where it's supposed to being redirected. (API is running on localhost:3000)
The client application is running on localhost:4000
These are my configurations in developers.facebook.com:
Settings > Basic
Products > Facebook Login

How to create Redirect URL for an app using Google API? (OAuth client)

I need the following information for my app to work:
1) Client ID
2) Redirect URL
Setting up the app and creating an ID + secret code was easy. But I have no idea what to put as my redirect URL. I used localhost as my URL and I was able to sign into my google account but after I signed in I received Error: redirect_uri_mismatch
Screenshot
What can I do? How do I even create a redirect URL?
In the Developer Console credentials page (the one in your screenshot), add your redirect URI to the "Authorized redirect URIs" text field.
Ensure you're supplying the correct port and correct route your server is listening on too.
For example, in the Google API Console, the working redirect URI for me is
Your port and route all depend on your server setup (ie. look in your index.js if you're using Node). This working sample with port 5000 is from the example server code in the YouTube API NPM module readme.

Sign in with Yammer is using 'http' instead of 'https' so fails with 'Invalid Redirect URI' error

Yammer login works correctly when I am logging in using my own Yammer account for our network. Whenever I use anyone else in our network I get an 'invalid redirect uri' error. Is there a reason why it would only work when I am logging in and not other people? Would the redirect uri error be purely Yammer server side related?
I had everything set up correctly in the Yammer created apps but I was visiting my production url using http instead of https. This was then overriding the redirect uri. I could fix this by changing the url on the invalid redirect_uri page to include the s and it would redirect correctly.
Seems like a bug that the source url would override the http part of the Yammer Created Apps redirect uri.

Resources