Question

I have found some similar questions on the website, however I couldn't find the proper answer that works for my website.

So far, OAuth it looks hard to implement for me, Facebook was much easier.

I am trying to integrate OAuth to one of my websites. The problem is that I am using a subdomain for it and I'm getting and error when I press on the Google login button:

The redirect URI in the request: http://a.example.com/auth/google did not match a registered redirect URI

In Google Developers Console, I didn't added anything in the Javascript Origins, but added the following to the Redirect URIs:

https://a.example/auth/google_oauth2/callback

I also found this .htaccess code and used it, but doesn't seem to change anything:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^google\.
RewriteCond %{QUERY_STRING} state=([a-z0-9]+)
RewriteRule ^(.*)$ http://%1.example.com/$1 [L]

Anyone knows what needs to be done to integrate OAuth with a subdomain?

Was it helpful?

Solution

The answer is in the question. "http://a.example.com/auth/google" doesn't match "https://a.example/auth/google_oauth2/callback".

The match needs to be character perfect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top