Implementing Google federated login using Hybrid Protocol (OpenID+OAuth)
June 3, 2010 81 Comments
How it works ?
Just a few days ago, I was badly in need to implement Google federated login using Hybrid Protocol (OpenID+OAuth). After searching a while I found myself that I was not keen to read. So read the Federated Login for Google Account Users again and found the solution.
To use Google service all you need
OAuth Consumer Key
OAuth Consumer Secret
How to get OAuth Consumer Key and OAuth Consumer Secret
Step 1 : First you need to add your domain name in google. To add your domain click
Step 2 : In Add a New Domain put your domain (sign in if you don’t) and you will get Manage your.domain.name below.
Step 3 : Click on Manage your.domain.name will get Verify ownership page. You will have
Site URL
Verification status
Verification method
Verification Status obviously Not Verified . To verified your domain with Google service you can choose Meta Tag, Upload an HTML file or Add a DNS record from select box. Choose whatever you want. Here we take Meta Tag. Something like
<meta name="google-site-verification" content="OTInrbJb1bsZ4JODXahOcdA2Ab16zZEcOURtss2Fnws" />
Add this meta tag in your site root file (i.e: index.php or index.html) on your site and then click verify button.
Step 4 : After verification it’s time to get the OAuth Consumer Secret. Now create your certificate authority first. The easiest way to create X.509 certificates on Linux is the openssl command. In your LINUX box got to terminal and paste the following code.
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj ‘/C=US/ST=CA/L=Mountain View/CN=www.example.com’ -keyout myr
sakey.pem -out /tmp/myrsacert.pem
Now, you have your .pem file in /tmp/myrsacert.pem and upload and save it to your google account management.
You will see something like:
OAuth Consumer Key: your.domain.name
OAuth Consumer Secret: mx4KGNaNdcqHt+BDuJusaUvc
Step 5 : You are all most done! Just download the Source Code and run. You will need Zend Gdata library. If you don’t have you can download it form here.
“The demo illustrates the simplicity of a combined user interface doing double duty: view a page requesting sign-on approval and access to your Google Docs and Spreadsheets services, click “Continue Sign-in”, and voila: you’re logged into the site and viewing a list of all your Google docs. All the authentication/authorization is happening behind the scenes, while the cost to the user is one page view and one click.”
Now you can play on Google as well. Visit Google Developer’s OauthPlayGround to discover OpenID+OAuth in action
Thanks for reading my blog.
References:
Google API
OpenID Federated Login Service for Google Apps
Federated Login for Google Account Users
Generating keys using OpenSSL
Just downloaded all the source files and will play with getting them working tonight in a way that will integrate with my site. Thanks for posting this code and these instructions.
I heard that Google was working on an OAuth method of authenticating for Gmail so you wouldn’t have to ask users for their ID/Password to access their Gmail accounts with IMAP. Have you done any experimenting with that?
Hello Greg,
Thanks for your comment.
I guess, you were asking for identifying your application to users. Google normally displays the name of an application when requesting access consent from the user (see example). For more information please visit Authentication and Authorization for Google APIs
Best,
Tanveer
Hey, in this step:
“Now, you have your .pem file in /tmp/myrsacert.pem and upload and save it to your google account management.”
I don’t know where i can do this, can you help me? :{
Thanks a lot for the tutorial, they help me so much.
Hi Victor,
Thanks for your comment.
If your using Linux box then go to your Terminal/Konsole and just paste the “sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -subj ‘/C=US/ST=CA/L=Mountain View/CN=www.example.com’ -keyout myrsakey.pem -out /tmp/myrsacert.pem” and you will fine your .pem file in the /tmp directory.
Pingback: 2010 in review « Tanveer's Weblog
Hi, i believe that i saw you visited my website so i came to go back the desire?
.I’m attempting to to find things to enhance my website!I assume its good enough to use some of your ideas!!
Yes you can 🙂
Great post. I was checking constantly this blog and I’m impressed!
Very helpful info particularly the last part 🙂 I care for such info much.
I was seeking this certain information for a very long time.
Thank you and best of luck.
Hi Juana,
Thanks a lot for your comment. It’s inspire me to write more. Cheers!
— Tanveer
Heya i am for the first time here. I found this board and
I find It really useful & it helped me out much. I hope to give
something back and aid others like you helped me.
Thanks for visiting my blog. Your comment inspired me a lot to post more. Cheers!
Thanks for your marvelous posting! I genuinely enjoyed reading it,
you could be a great author.I will always bookmark your blog and will come back from now on.
I want to encourage you to ultimately continue your great job,
have a nice afternoon!
Thanks Antenne! It feels great to have such complement. Cheers!
This post is invaluable. How can I find out
more?
Hi,
Thanks for your comment. If you have more interest on this then please visit my blog sometimes later. Hope will post a related soon.
Cheers!
Hello colleagues, nice paragraph and good urging commented at this place, I am
really enjoying by these.
Excellet blog right here! Additionally ƴour website lots
up fast! What web host aare youu tɦe use of? Ϲɑn Ӏ gget yoսr associate hyerlink іn youг host?
I desire my site loaded up ɑs fast aѕ yours lol
Yes, you can. Thanks!
Great post! We are linking to this great content oon our site.Keep
up the great writing.
Thanks!
Hi there, just wanted to tell you, I loved this blog post.
It was funny. Keep on posting!
Thanks!
This is the perfect website for anyone who wants to
find out about this topic. You understand a whole lot its almost tough to argue with you
(not that I actually would want to…HaHa). You definitely put a new spin on a
subject that has been written about for years. Wonderful stuff, just excellent!
Thanks 🙂
Magnificent goods from you, man. I have understand your stuff previous to and you’re just too great.
I actually like what you’ve acquired here, really like what you’re saying and the way in which you say it.
You make it entertaining and you still take care
of to keep it smart. I cant wait to read much more from you.
This is really a tremendous website.
Thank you Charla! Much appreciate your comments. Happy Blogging 🙂
Hey, I think your website might be having browser compatibility issues.
When I look at your blog in Opera, it looks fine but when opening
in Internet Explorer, it has some overlapping. I just wanted
to give you a quick heads up! Other then that, very good blog!
Hey, Thank you for your observation. As this site is now hosted under wordpress so I need to issue a ticket for this. Could you please let me know which IE versio you are using?
Thank you, I have recently been searching for info approximately this topic
for ages and yours is the best I’ve discovered till now.
But, what in regards to the bottom line? Are you certain in regards
to the source?
Thanks for your comment. It seems like the example I was written now obsulate. My bad! Need to change the link.
Great post. I was checking constantly this blog and I
am impressed! Very useful information particularly the last
part 🙂 I care for such information a lot. I was looking for this certain info
for a long time. Thank you and good luck.
Thanks
We stumbled over here by a different web page and thought
I may as well check things out. I like what I see so now i’m following you.
Look forward to looking over your web page again.
Thanks for your comment. Stay with me. Lots of post are coming soon.
Un saluto. È la prima occasione che visito il forum e vi dico grazie per avermi accettato.
Gracias por visitar mi blog. 😛
I’ve read several excellent stuff here. Definitely worth bookmarking for revisiting.
I surprise how so much attempt you place to make
this sort of excellent informative web site.
Hey,
Much Appreciate your compliment. Stay with this blog. More updates are coming soon.
Happy Coding!
🙂
Hi there everyone, it’s my first go to see at this web site,
and article is genuinely fruitful for me, keep up posting such posts.
I don’t even know how I ended up here, but
I thought this post was good. I do not know who you
are but certainly you are going to a famous blogger if you aren’t
already 😉 Cheers!
Thanks for your complement.
I constantly spent my half an hour to read this web site’s posts everyday along with a cup of coffee.
What’s up, I would like to subscribe for this blog to get hottest updates, so where can i do it please assist.
Follow my blog 😉
It’s really a great and useful piece of information. I’m satisfied that you shared this helpful info
with us. Please keep us up to date like this. Thank you for sharing.
I will 🙂
I think this is among the most vital info for me.
And i’m glad reading your article. But should remark on few
general things, The site style is wonderful,
the articles is really nice : D. Good job, cheers
Thanks Solimar for your nice comment.
After I initially left a comment I appear to have clicked the -Notify me when new comments are added- checkbox and from now on every time a comment is added I receive 4 emails with the exact same comment.
There has to be a means you are able to remove me from that service?
Kudos!
Thanks
Thanks for sharing your info. I truly appreciate your efforts and I will bee waiting for your further post thank you once again.
Thank you for your nice comment. 🙂
Hello There. I found your blog using msn. This is an extremely well
written article. I’ll make sure to bookmark it and come back to
read more of your useful information. Thanks for the post.
I’ll definitely return.
Thanks 🙂
Thank you a bunch for sharing this with all of us you actually know what you
are speaking approximately! Bookmarked. Please also
discuss with myy sitee =). We could have a link exchange
contract between us
Thanks and sure I will 🙂
My partner and I stumbled over here by a different website and thought I might check things out.
I like what I see so i am just following you. Look forward to looking into your web page repeatedly.
Thanks for your nice comment.
Thanks for another magnificent post. The place else could
anybody get that type of info in such a perfect
way of writing? I’ve a presentation subsequent week, and I’m at the look for
such information.
Thanks 🙂
Dziękuję za ten pomocny artykuł, oby więcej takich
Thank you 🙂
Thanks for some other great post. Where else may anybody
get that type of info in such an ideal manner of writing?
I have a presentation subsequent week, and I am at the look
for such information.
This excellent website truly has all the info I needed about this
subject and didn’t know who to ask.
Аlgunoѕ post me interesaron algo mas pero bueno, no
esta mal tampoco 😉
Hello there! Do you know if they make any plugins to help with SEO?
I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
very good success. If you know of any please share.
Appreciate it!
I will. Happy coding !
Dziękuję za ten post, oby takich więcej
Thanks 🙂
great issues altogether, you simply received a emblem
new reader. What might you suggest about your submit that
you made a few days ago? Any sure?
Thanks for your comment.
Nice blog! Is your theme custom made or did you download
it from somewhere? A design like yours with a few simple tweeks would
really make my blog stand out. Please let me know where you got your design. Thanks
Thanks!
I loved as much as you’ll receive carried out right here.
The sketch is tasteful, your authored subject matter stylish.
nonetheless, you command get bought an impatience over that you
wish be delivering the following. unwell unquestionably come more formerly
again since exactly the same nearly very often inside case you shield this hike.
What’s up to every one, the contents present at this website are genuinely remarkable for people experience,
well, keep up the good work fellows.
Thanks for your comment 🙂
This is my first time pay a visit at here and i am truly impressed to read all at single
place.
certainly like your website however you need to check the spelling on several of your posts.
A number of them are rife with spelling issues and I to
find it very troublesome to tell the reality then again I will certainly
come again again.
You actually make it seem so easy with your presentation but
I find this matter to be actually something that I think I would
never understand. It seems too complicated and extremely broad for me.
I am looking forward for your next post, I’ll try to get the hang of it!
If some one needs to be updated with newest technologies afterward he must be pay a visit this web page and be up to date every day.
Thanks Edwardo 🙂