简体   繁体   中英

How to authenticate a user with Google gmail account like stackoverflow

I want to authenticate a user using Google account. I had developed oauth using some libraries.

But it is giving me a message like some website is asking permission to access google docs/calendar/etc., .

When we are logging into stackoverflow.com it is asking stackoverflow.com is accessing you@gmail.com. How can i get a permission for email address.

Update: I developed oauth using Zend PHP library.

And see the screenshots

stackexchange.com

在此处输入图片说明

My application screenshot

在此处输入图片说明

Thank You

At the moment, I'm working on example ZF 1.11 application that uses OpenID and openid-selector. The ZF application, called zfopenid, can be downloaded from here (it contains full ZF library and it should work out of the box): 在此处输入图片说明 Authentication with google, yahoo works (at least for me) at this stage. To make it work I needed to make some changes in Zend_OpenId_Consumer described at http://framework.zend.com/issues/browse/ZF-6905 + some additional changes. Also I incorporated My_OpenId_Extension_AttributeExchange (ie AttributeExchange implementation by Chris Bisnett) to fetch email from google, yahoo (at the moment it is not displayed, but it should be in $_GET variable returned from google, yahoo, aol or myopenid to user/login).

So, if you or anyone would like to test it, I would be grateful as I'm planning to eventually write a blog post about this. Any feedback would be very helpful at this stage. Specifically, whether it really works, or it just works for me (I'm running it on localhost using XAMPP for Linux 1.7.3a and Linux Mint 10).

I did some experiment with ZF to create OPEN ID login form , but i case of google , i was able to sign in but i wasn't able to ask google for the user info

because google is implementing openid extension called AX as i remember , while ZF implement only SREG , you can find it in library/Zend/OpenId/Extension

here is my demo example http://zc.dagho.com/index/login , its working very nice with google and others but it can't ask for users info

and you can take alook to : How to get OpenID user Profile info?

Google implements AX as well as Yahoo (you have to request permission from yahoo). Unfortunately Zend Framework OpenID only supports SREG at the time of this writing but I've written an extension for AX support here as well ak33m.com/?p=71 – Akeem Oct 29 '09 at 2:27

http://framework.zend.com/issues/browse/ZF-6905

update : this might be good , i didn't test it : http://framework.zend.com/issues/browse/ZF-7328

您可以像在stackoverflow登录中一样使用Google Open ID对用户进行身份验证。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM