问题
Please check http://www.udayan2k12.com/trial.html
I have just copied the source from Google link (Source)
Original Page link
I have changed the client id and api key
Still this is not working
My Cliend ID details are ![enter image description here][1]
Client ID: 365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk.apps.googleusercontent.com
Email address: 365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk@developer.gserviceaccount.com
Client secret: --
Redirect URIs: none
JavaScript origins: https://www[dot]udayan2k12[dot]com
API key: AIzaSyA0FVy-lEr_MPGk1p_lHSrxGZDcxy6wH4o
What Changes shall i do to make it work. The Authorize button doesn't work.
But it works in http://udayan2k12[dot]com/token.html
回答1:
If you check the error console you'll see that you get the following error:
Failed to load resource: the server responded with a status of 400 (Bad Request) https://accounts.google.com/o/oauth2/auth?client_id=365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffusiontables&immediate=true&redirect_uri=postmessage&origin=http%3A%2F%2Fwww.udayan2k12.com&proxy=oauth2relay665167919&response_type=token&state=225646027&authuser=0
And when you follow the link, the error message you get is: origin_mismatch
This means you did not add http://udayan2k12.com (and not https) to the allowed JavaScript origins for your client id. You can change that on the Google API Console (Tab "API Access"). You could add localhost as well so it works on you machine, too.
Here is an example of my settings:
Please check the OAuth 2.0 guide from Google for all the steps you need.
来源:https://stackoverflow.com/questions/12281668/insert-into-fusion-table-using-javascript-and-oauth2