Phonegap Google authentication

邮差的信 提交于 2020-01-04 23:06:24

问题


Is this even possible? I've tried lots of solutions: oAuth2, looked at Twitter oauth examples, clientLogin... And it needs to work in Phonegap (Javascript). I'm having a hard time figuring this out and all I need is a user's email (verified). Anyone ever tried this?


回答1:


It's possible but kind of a bitch, pardon my French. First you need to register your app. I am working on integrating Google oAuth2 to an Android app, so I chose "installed app" as an option. G gave me a client id I have to pass along a bunch of other parameters, including a fake redirect uri so that the code appears in a page, both in the header and inside a .

Worst case scenario -- which is where I'm at -- if you're on a similar case as me, redirect the user to the browser to authenticate, and ask them to copy the code given back to your app. Use that thereafter.

Or, if you're smart enough to load the auth page inside your own page and get the code directly, use that.

I'll get back to you once I have this worked out.

HTH

EDIT: Alright, I've got it to work. I am going to upload a sample project on google code, look for googleoauth2phonegap in a couple of hours. http://code.google.com/p/googleoauth2phonegap/



来源:https://stackoverflow.com/questions/10656820/phonegap-google-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!