13

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?

Xiaoxin
  • 135
  • 1
  • 5
  • 3
    this should not have been closed off topic: "desired behavior": it should not give him the error origin Mismatch. the author clearly stated what he was doing wrong, and steps he/she did to produce.. – Jeryl Cook Jan 31 '16 at 15:58
  • 1
    Agreed, this is really helpful and relivant – Fergus Apr 02 '16 at 03:14

3 Answers3

13

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.

9

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.

garish
  • 637
  • 12
  • 14
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.

blzbrg
  • 148
  • 9