问题
I'm having trouble creating a valid google drive API for my website. I may sound like a complete noob, but I created a file called quickstart.html in my main ftp directory and copied and pasted the code from https://developers.google.com/drive/quickstart-js#step_1_enable_the_drive_api and replaced the client id with my client id, and in my settings I set the Javascript Origins URL to my main url (www.domainname.com), I have a separate index page for that domain, so to access google drive do I just go to http://domainname.com/quickstart.html? Because when I do that and click "Authorize" I get the google Origin Mismatch error. Can anyone help me please?
回答1:
in Api Console replace your redirect urls to http and remove https and You can also use 'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email' . This solution worked for me.
回答2:
Verify that "JavaScript origins:" Property under Section "Client ID for web applications" and the URL of the page on which you are applying the login code must be same.
回答3:
Make sure that you are actually accessing www.domainname.com not just domainname.com. Some browsers will hide the actual url until you copy-paste the url into another program. Make sure you type the whole URL, with the http and the www. to be absolutely sure.
来源:https://stackoverflow.com/questions/15424441/google-drive-api-oauth-2-0-error-origin-mismatch