Phonegap Google身份验证 [英] Phonegap Google authentication

查看:170
本文介绍了Phonegap Google身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是可能吗?我试过很多解决方案:oAuth2,看看Twitter的oauth示例,clientLogin ...它需要在Phonegap(Javascript)中工作。我很难知道这一点,我需要的是一个用户的电子邮件(验证)。任何人都曾试过这个?

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?

推荐答案

这可能是一种。子,首先,你需要注册你的应用程序。我正在将Google oAuth2集成到Android应用,因此我选择了已安装的应用。 G给了我一个客户端ID,我必须传递一堆其他参数,包括一个假的重定向uri,使代码出现在一个页面,在标题和里面。

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

编辑:
好​​吧,我有它的工作。我将在google代码上传一个示例项目,在几个小时内查找googleoauth2phonegap。 http://code.google.com/p/googleoauth2phonegap/

这篇关于Phonegap Google身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆