Google + sign in - google-plus

I'm implementing the login using google+ account in my website. For this I used the google plus api and while singin google + I got "Error:404 origin miss match". But I provided the right origin like my localhost url.Please suggest to me.
Thanks in advance.

You likely haven't set up the origin in the API console for your client ID. Make sure on the API console (https://developers.google.com/console) that the Javascript origin matches what you're using (including port number!). Note that this is different from the redirect URL - you may have set one, but not the other.
As Satal suggests though, posting some code if you still have problems would help - but I would definitely check you are using the client ID setup with the origin you expect.

Related

Vue + Flask Gmail API

I am attempting to build a webapp using Vue for the frontend and Flask for the backend that reads in the users Gmail emails.
Desired functionality:
User clicks a button to "Link Gmail Account" on the frontend
User is authenticated with gmail Oauth2 and confirms. Once confirmed, they redirect back to the page they were on
Once the user confirms, the backend queries gmail to get all of the users emails and returns the data to the frontend
I have been trying to use https://developers.google.com/gmail/api/quickstart/python as a starting point, but I cannot authenticate the user -- I keep getting a redirect uri mistmatch error with a random port (I am doing this locally so have set the redirect uri to be the localhost port where I access my project).
I think I am doing something fundamentally wrong or not using the Gmail API in the correct way, but have searched all over google and youtube to no avail.
Specific things that I think could be causing an issue:
What is the best overall strategy to implement this? Should I use the Gmail API in Python or Javascript? Right now, the use clicks the "Link Account" button which calls an API in my backend which then runs the code in the Python Quickstart guide.
What kind of google project should I set up? I currently have my credentials configured for a "web application"
What should I put as the redirect uri? I am using localhost but am unsure exactly what to put here (I have tried http://localhost, http://localhost:5000, http://localhost:5000/, http://localhost:5000/emails [this is the url I want them to return to]). No matter what I put, I keep getting a redirect uri mismatch and it says the uri it is looking for is http://localhost:[random port]/
I would appreciate any help on how to approach achieving this. Thank you!
Depending on what you are going to use Gmail API for, you must select the device or category. In your case, as it is a website it should be set to "Web Application".
Also, you should be using the following redirect URI: http://localhost/emails/. You should not include the port number and you should be using trailing slashes (adding the last / at the end). Note that the redirect URI you set up in your backend must be an exact match of the one you have set up in your Credentials Page. Also please note that it might take some minutes to update this URI.
Moreover, this is a guide on how to create a Sign In button that will authorise your users that I believe will be useful for you.

API For Google PageSpeed Insight

I just setup Google PageSpeed Insight into my Google Webmaster but whenever I am trying to do PageSpeed Test this error occurs "The referrer https://www.googleapis.com/ does not match the referrer restrictions configured on your API key. Please use the API Console to update your key restrictions."
I already created API for my URL and Created Restriction of HTTPS Referrers and submitted my Website in it but still not working.
Any solution for it?
You have set your restrictions incorrectly, the error message points you directly to the problem.
Remove all restrictions and try again, then slowly add restrictions until you reach the problem.
If you have restricted Accept requests from these HTTP referrers (web sites) (Optional) then bear in mind you have to verify your site first for some APIs to function correctly.

Google Maps API 3 referrerNotAllowedMapError

I'm no stranger to Google Maps APi, and have used it for years...but I am stumped. I've installed an exact copy of the latest code sample from Google Maps Javascript API: Simple Map. I then confirmed both my browser and server keys from Google Developers Console, added the refer two different ways(see below). Code works when I set the referer to * wildcard in console, but cannot use that in production.
Here's the skinny:
tested using latest example code from Google Maps API Javascript (Simple Map)
YOURAPIKEYHERE - replaced with an active browser key from my account
referer was tried as both *./domain.ext/* and domain.ext/*
Also tried a server key, with server IP as allowed referer.
CANNOT USE, BUT WORKED : used a wildcard for allowed referer using browser key, but I can't use that in production...anyone could use my key on my dime
SUSPECTED CULPRIT
Since the key works when I add a wildcard, but not with the referer domain name, it seems suspicious. This should indicate that the key works, but that the referer information is not getting passed to Google.
My site is behind CloudFlare. My research is not finding any answers anywhere, but I'm beginning to wonder if this could be the issue. Nothing else seems to work.
SOLUTION:
The google console specifically shows the format for this. But it is WRONG.
Instead of *./domain.ext/*
use: http://domain.ext/*
A special thanks to Google for crappy docs, and a very special thanks to the user that downvoted my question!
Note: Depending on your setup, it may be necessary to use: http://www.domain.ext/*
I did not test this as my use case excludes www.
I know you found a misconfiguration in your API key but I had the same issue and found a different fix.
Cloudflare can mess this up. Testing with mine now shows rocket loader and Brotli in the speed area stop google maps working. Deactivate them and clear the cache to fix.

Error: redirect_uri_mismatch

I've been looking for this answer and the other pages didn't help me.
I'm trying to use the google drive api for php. I am trying to test on my local environment and receive this error.
Error: redirect_uri_mismatch
The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob did not match a registered redirect URI
Request Details
scope=https://www.googleapis.com/auth/drive
response_type=code
redirect_uri=urn:ietf:wg:oauth:2.0:oob
access_type=offline
display=page
prompt=consent
client_id=735129338633-0epug8n80jsg0t50ijn7our4a661nnk6.apps.googleusercontent.com
Here is the page for the api:
The url is in
localhost:8888/Spreadsheets/driver.php
What am I doing wrong?
Looks like the current Google OAuth2 integration requires enabling
Contacts API
Google+ API
from the Google Developers Console for the associated Project. In my log I noticed errors liek 403, Access Not Configured. Please use ....
The redirect URI (where the response is returned to) has to be correct and exactly as you registered in the APIs console, and the error is indicating that you haven't done that or you haven't done it correctly.
To get the redirect URI from console:
Go to the console for your project and look under API Access.
Open Credentials section (in left side)
You should see your client ID & secret there, along with there is a
list of redirect URIs. If you want to change it or it was wrong,
click edit settings and modify.
Even if your redirect uri is properly set in the console, a lot of times, when you've recently changed settings in the google dev console, it will still tell you there's a redirect mismatch. It's a surprisingly common occurrence.
You can try...
Waiting; some have had luck with this, indicating that google takes some amount of time to register recent changes.
If you don't mind reconfiguring your app, creating a new client id in the google dev console tends to fix this problem with consistent results.

google weather api links need human authentication

I developed a weather app using google weather API
but from today it stopped working.
When I tried to access the weather API using location through browser it asks for human authentication.
How can my app work when it is like this? Is there a way to bypass the authentication process?
It's very odd behavior...I wonder if it has something to do with headers that are passed along as when I try loading the API url in Chrome, Unsupported API...or if I do same URL in Firefox, works just fine.
It's also worth noting that I tried setting up an Apache Proxy to Google's weather service by placing the following two lines in a separate Web Server's apache config and referenced the API via www.domain.com/weather/api?weather=Chicago and it still works...so that's my workaround for now:
ProxyPassReverse /weather/ http://www.google.com/ig/
ProxyPass /weather/ http://www.google.com/ig/
Try to change domain, ex: http://www.google.ca/ig/api?weather=Sondrio . It works (for now :D).
Looks like it is out of use from now on
Even using .CA it returns Unsupported API randomly.
Pity
Yeah, interesting, Google seems to send back random "Unsupported API" responses if the request is missing the cookies that the browsers (tested with Chrome and Firefox) are including with requests to the inofficial weather URL.
I've fixed my application by copying the entire "Cookie:" header I found when I ran the request in Firefox with Firebug's "Net" tab enabled.
Not sure where on .google.com the browser got the cookies from yet, I presume from using a personalized service like gmail.
if you are looking for a weather API that works right now, I have a suggestion…
Try Metwit Weather API, it's new but sounds very cool…
This api is really simple to use because it use standards that are available nowadays, like JSON and REST.
you can use this new api this has the same xml structure of google weather api
http://en.previmeteo.com/professionals/google-weather-api.php