Home » Php » php – How to authenticate a user with Google gmail account like stackoverflow

php – How to authenticate a user with Google gmail account like stackoverflow

Posted by: admin July 12, 2020 Leave a comment

Questions:

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 [email protected] How can i get a permission for email address.

Update: I developed oauth using Zend PHP library.

And see the screenshots

stackexchange.com

enter image description here

My application screenshot

enter image description here

Thank You

How to&Answers:

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):
enter image description here
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 (i.e. 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).

Answer:

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

Answer:

I believe Stackoverflow uses the http://www.dotnetopenauth.net/ library.

https://meta.stackexchange.com/questions/56109/stack-overflow-and-dotnetopenauth

Answer:

you can authenticate users using google open id as in stackoverflow login.