javascript - Google App Engine Cloud Endpoints: OAuth2 won't work. Can't load api -


this confusing me. have followed examples adding authentication endpoints listed here . unfortunately, whenever deploy app engine, 404 not found error when try load the oauth api using line:

gapi.client.load('oauth2', 'v2', loadcallback);

i javascript error message: *failed load resource: server responded status of 404 (not found) *

i can't seem fix this, , can't call gapi.client.oauth2.userinfo.get(); however,

gapi.auth.authorize

works fine. ideas? authorisation works correctly android.

thanks

wow, took me long time find silly. i'm going leave answer here in case has similar issue.

the problem stemmed using app engine plugin generated "connected android" project. starts off without auth, follow instructions add auth linked above.

the trouble in created index.html file, underneath line <script src="https://apis.google.com/js/client.js?onload=loadgapi"> there specifications forcing gapi.client.load use domain. remove code (everything in braces) looks like:

<script src="https://apis.google.com/js/client.js?onload=loadgapi"> </script> 

however, none of working calls gapi.client.load endpoint api's work. fix this, need specify should use url so:

gapi.client.load('deviceinfoendpoint', 'v1', loadcallback, api_url );

here api_url 'http://' + window.location.host + '/_ah/api';


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -