Facebook Oauth URL Blocked - ruby-on-rails

I'm currently testing my Ruby on Rails project Omniauth with Facebook functionality and no how I enter my Redirect URI it fails.
The exact error is:
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.
If I do,
https://localhost:3000/users/auth/facebook/callback
it then complains about trying to an ssl certificate to a non ssl puma. Are there any suggestions for this issue? Perhaps, working on my SSL certificates or any other solution.
I've been looking into similar posts and nothing has solved this issue. Please advise.

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

Unable to enable google oauth2 with devise

I'm trying to enable OAuth via google. I've configured that callback URL but when trying to authenticate I get an error saying
The redirect URI in the request, https://example.com/users/auth/google_oauth2/callback, does not match the ones authorized for the OAuth client
I set Authorized JavaScript origins to https://example.com and the redirect to https://example.com/users/auth/google_oauth2/callback.
I'm using devise 4.3.3
I would aim to trace HTTPS messages so that you can see exactly what is being sent over the wire - use a tool such as Fiddler or Charles.
Standard messages for a Web UI look like those from my write up. Google messages will be equivalent.
Hopefully this approach will enable you to resolve your own problem. If not then please update your question with full HTTP message details

How can I edit existing Authorized redirect uri in google console?

I created an oAuth key for my laravel site for google login. I successfully implemented this in local. But when I migrated my site to live I got this error:
400. That’s an error.
Error: redirect_uri_mismatch
Request Details
client_id=xxxxxxx-0fic8dnvcgo672unju9ai619iXXXXXX.apps.googleusercontent.com
redirect_uri=https://laravel.themenepal.com/gharsansar/auth/google/callback
scope=openid profile email
response_type=code
state=NRu0eU9UdwEXYSV0dixOc0BjuH3bluFkHiBDJFgO
That’s all we know.
I think this is primarily due to redirect url being mismatched with what is set in Google console. I've changed the redirect urls in .env. I have searchd a lot to be able to update the redirect uri in google console but nothing helped.
If you know that would be a great help.
UPDATE: The screenshot of the url edit page is as follows:
If you goto: https://console.developers.google.com/apis/credentials and select the correct project, then the correct the correct OAuth 2.0 client IDs and edit the correct OAuth 2.0 client IDs.
There appears to be no option to edit it if it's created as an OAuth 2.0 client ID of type "Other." If you choose Web Application, you can edit them yourself.

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

omniauth openid invalid credentials

I am using omniauth and logging into google and yahoo using the open_id strategy. This was working fine, until I enabled SSL on my site. There was a couple issues. First the URL's being generated were still pointing at http instead of https. I fixed that using a monkey patch from other posts(Omniauth and open_id with Google broken when running behind nginx in SSL mode, OpenID for rails app behind Apache)
Now it seems like the URLs are okay, but now I always get invalid credentials failure. I am using nginx and unicorn and hosting on EC2, if any of that is relevant. I see this in my unicorn logs:
(google) Request phase initiated.
WARNING: making https request to https://www.google.com/accounts/o8/id without verifying server certificate; no CA path was specified.
Generated checkid_setup request to https://www.google.com/accounts/o8/ud with assocication ...
(google) Callback phase initiated.
(google) Authentication failure! invalid_credentials encountered.
*Note I remove the association above because I was not sure if thats some private key or something.
Also, I see google posting to my callback "/auth/google/callback".
Finally, about the warning about making a request without verifying server certificate, I saw in another post that I should add this:
require "openid/fetchers"
OpenID.fetcher.ca_file = "/etc/ssl/certs/ca-certificates.crt"
which I did, and the messages go away but does not fix my problem. Am I supposed to point this to my ssl certificates instead?
Just confused about what is going on and not finding good logging output to identify the problem...

Resources