Google App Engine login URL redirect phonegap -
i writing cordova (phonegap) application uses google app engine backend logins , database. google app engine seems structured handle urls within application, that's not how cordova things. using users.create_login_url()
direct users google's login page. first argument function redirect url either full url or location relative application. enter '/home'
or url 'http://google.com'
want application redirect cordova page on when user clicked button login. entered 'http://localhost'
i'm not sure work way i'm expecting to. work, or need else?
essentially, make request login using jquery.ajax():
$.ajax({ type:'post', url:'http://localhost:8090/login', //i running in gae developer runtime success:function(data) { window.location = data; } });
the above code should call post() method in login class have created in gae. code in method this:
def post(self): user = users.get_current_user() if user: self.response.write("useralreadyloggedin") else: self.response.write(users.create_login_url("http://localhost")
i haven't tested yet, ignoring unrelated errors may have had, described above?
you going need redirect rather write log in url response object.
self.redirect("/home")
https://developers.google.com/appengine/docs/python/tools/webapp/redirects
also webapp2 documentation worth look:
http://webapp-improved.appspot.com/api/webapp2.html#webapp2.redirect
Comments
Post a Comment