Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Simple PHP Class for Google Federated Login
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  22 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
apeace  
View profile  
 More options Dec 11 2008, 12:19 pm
From: apeace <ape...@gmail.com>
Date: Thu, 11 Dec 2008 09:19:06 -0800 (PST)
Local: Thurs, Dec 11 2008 12:19 pm
Subject: Simple PHP Class for Google Federated Login
I went looking for a simple PHP class to handle Google Federated Login
and found some that claimed to be "simple" but weren't. So, I decided
to write my own.

http://www.andrewpeace.com/php-google-login-class.html

I know there are lots of generic OpenID libraries out there, but I
didn't feel like lugging around all the extra functionality when all I
needed to do was work with the Google API. So, that's all my class
does! It's dirt simple.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David TREBOSC  
View profile  
 More options Dec 11 2008, 12:26 pm
From: "David TREBOSC" <david.treb...@macoda.com>
Date: Thu, 11 Dec 2008 18:26:56 +0100
Local: Thurs, Dec 11 2008 12:26 pm
Subject: Re: [google-federated-login-api] Simple PHP Class for Google Federated Login
Cool think but I guest that if you don't use PHP OpenidEnabled it
could be really simple to fake your library ?
I look at your code and don't find the signature verification or something else.

Perhaps it's not very important but do you plan to add it ?

PS : Good initiative. It's easier to make critic thant to build your code.

David

2008/12/11 apeace <ape...@gmail.com>:

> I went looking for a simple PHP class to handle Google Federated Login
> and found some that claimed to be "simple" but weren't. So, I decided
> to write my own.

> http://www.andrewpeace.com/php-google-login-class.html

> I know there are lots of generic OpenID libraries out there, but I
> didn't feel like lugging around all the extra functionality when all I
> needed to do was work with the Google API. So, that's all my class
> does! It's dirt simple.

--
Cordialement
David TREBOSC

http://www.bdpv.fr - Base de données de production photovoltaïque
http://photovoltaique.pureforum.net - Forum Photovoltaïque
http://www.macoda.com/index.php/Maison:Solaire_Photovoltaique Mon
installation Photovoltaïque !

http://www.macoda.com - Wiki sur de nombreux autres sujets.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
apeace  
View profile  
 More options Dec 13 2008, 2:57 pm
From: apeace <ape...@gmail.com>
Date: Sat, 13 Dec 2008 11:57:14 -0800 (PST)
Local: Sat, Dec 13 2008 2:57 pm
Subject: Re: Simple PHP Class for Google Federated Login
Yeah, I do plan to add signature verification. Right now the class
only makes it easy to go through the motions of the API with a few
function calls. Once sig verification is there, though, I believe it
will support all the functionality of the Google API. Thanks for the
comment! :D

On Dec 11, 12:26 pm, "David TREBOSC" <david.treb...@macoda.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Breno  
View profile  
 More options Dec 13 2008, 4:14 pm
From: Breno <breno.demedei...@gmail.com>
Date: Sat, 13 Dec 2008 13:14:12 -0800
Local: Sat, Dec 13 2008 4:14 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login

Hi Andrew,

We appreciate your effort to help other developers at this forum. A few
suggestions:

1. Add the realm parameter to the function that creates the function.
Because Google's OpenID URLs are a function of the realm, we prefer that
developers set it consciously to the root of their site, instead of getting
it implicitly as the value of return_to, which is likely to change.

2. Since adding signature verification takes a bit more work, you could in
meanwhile have  a secure version without signatures by making it work in
"dumb mode" where you don't make the association request, but verify the
response simply by playing it back to our endpoint /accounts/o8/ud (via
POST) where the only parameter that changes is that "mode" changes from
"id_res" to "check_authentication". We will then simply tell you if the
signature verifies or not, and because our endpoint is HTTPs, this is a
secure mechanism.

3. When you get the signature code to work, you can re-introduce the code
that makes association requests. That will decrease latency of the entire
flow if the caller is saving the association keys and handles properly.

Thanks!

Breno (Google).

--
Breno de Medeiros

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
apeace  
View profile  
 More options Dec 14 2008, 2:48 pm
From: apeace <ape...@gmail.com>
Date: Sun, 14 Dec 2008 11:48:04 -0800 (PST)
Local: Sun, Dec 14 2008 2:48 pm
Subject: Re: Simple PHP Class for Google Federated Login
Hey, great feedback! Thanks a bunch. Exams this week....but I'll post
next week when I do some work on it.

On Dec 13, 4:14 pm, Breno <breno.demedei...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Saleha A Latif  
View profile  
 More options Dec 14 2008, 3:03 pm
From: "Saleha A Latif" <salehala...@gmail.com>
Date: Mon, 15 Dec 2008 01:03:41 +0500
Local: Sun, Dec 14 2008 3:03 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login

hi!
please can you tell me how i can get userid, last name first name?
i dont get it. plz help me
or if any1 know plz help me out.
i redirect the page to welcome but it dont get userid .....
thanks in advance.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
apeace  
View profile  
 More options Dec 14 2008, 3:51 pm
From: apeace <ape...@gmail.com>
Date: Sun, 14 Dec 2008 12:51:32 -0800 (PST)
Local: Sun, Dec 14 2008 3:51 pm
Subject: Re: Simple PHP Class for Google Federated Login
Hi Seleha,

Google doesn't provide the user's last name and first name. They only
provide their OpenID claimed identifier and their email address.

If you visit http://www.andrewpeace.com/php-google-login-class.html#user_email
you can see example code of how to fetch the user's identifier and
email address using my library. Just note that you'll probably want to
break it down into two files, like I did in my example.

If you have any more questions, maybe you could start a new thread
here in the group and cc me. If I can, I'd like to restrict this
thread to feedback on my PHP class. But I'd love to help you out
either in another thread or via email. :D

-Andrew Peace

On Dec 14, 3:03 pm, "Saleha A Latif" <salehala...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Saleha A Latif  
View profile  
 More options Dec 14 2008, 11:42 pm
From: "Saleha A Latif" <salehala...@gmail.com>
Date: Mon, 15 Dec 2008 09:42:24 +0500
Local: Sun, Dec 14 2008 11:42 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login

Yeah i do it same but my return page doesnt show anything.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
trebosc  
View profile  
 More options Dec 15 2008, 6:44 am
From: trebosc <david.treb...@gmail.com>
Date: Mon, 15 Dec 2008 03:44:32 -0800 (PST)
Local: Mon, Dec 15 2008 6:44 am
Subject: Re: Simple PHP Class for Google Federated Login
Hi,

I read you answer :

> 2. Since adding signature verification takes a bit more work, you could in
> meanwhile have  a secure version without signatures by making it work in
> "dumb mode" where you don't make the association request, but verify the
> response simply by playing it back to our endpoint /accounts/o8/ud (via
> POST) where the only parameter that changes is that "mode" changes from
> "id_res" to "check_authentication". We will then simply tell you if the
> signature verifies or not, and because our endpoint is HTTPs, this is a
> secure mechanism.

But ... don't work :-(

Using the parameters of the url, I build this form

<form method="post" action="https://www.google.com/accounts/o8/ud">
<input type="hidden" name="janrain_nonce"
value="2008-12-15T11:22:20Zjxg5oP" />
<input type="hidden" name="openid_ns" value="http://specs.openid.net/
auth/2.0" />
<input type="hidden" name="openid_mode" value="check_authentication" /


<input type="hidden" name="openid_op_endpoint" value="https://
www.google.com/accounts/o8/ud" />
<input type="hidden" name="openid_response_nonce"
value="2008-12-15T11:22:24ZtFXr8MOtVG4XjQ" />
<input type="hidden" name="openid_return_to" value="http://www.bdpv.fr/
checkauth.php?janrain_nonce=2008-12-15T11%3A22%3A20Zjxg5oP" />
<input type="hidden" name="openid_assoc_handle"
value="AOQobUdJSKAqiMIVvGhgM7MNw-ORPT-QAXTqIjBgZo6dpEgch5Fa1PEu" />
<input type="hidden" name="openid_signed"
value="op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handl e,ext1.mode,ext1.type.email,ext1.value.email" /

<input type="hidden" name="openid_sig" value="q6IV
+U0XO64qgO6jGto1qEW8v18=" />
<input type="hidden" name="openid_identity" value="https://
www.google.com/accounts/o8/id?id=AItOawk31s5C6yW_0X2JCe_LCE3twp1Rvj76kts"
/>
<input type="hidden" name="openid_claimed_id" value="https://
www.google.com/accounts/o8/id?id=AItOawk31s5C6yW_0X2JCe_LCE3twp1Rvj76kts"
/>
<input type="hidden" name="openid_ns_ext1" value="http://openid.net/
srv/ax/1.0" />
<input type="hidden" name="openid_ext1_mode" value="fetch_response" />
<input type="hidden" name="openid_ext1_type_email" value="http://
schema.openid.net/contact/email" />
<input type="hidden" name="openid_ext1_value_email"
value="david.treb...@gmail.com" />
<input type="submit" value="go AVEC INFO URL" />
</form>

But when I used it the answer is :
Page not avalaible :-(

What is wrong ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Breno  
View profile  
 More options Dec 15 2008, 1:54 pm
From: Breno <breno.demedei...@gmail.com>
Date: Mon, 15 Dec 2008 10:54:53 -0800
Local: Mon, Dec 15 2008 1:54 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login

Maybe an encoding issue? Shouldn't you be escaping these URLs?

--
Breno de Medeiros

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David TREBOSC  
View profile  
 More options Dec 15 2008, 2:36 pm
From: "David TREBOSC" <david.treb...@macoda.com>
Date: Mon, 15 Dec 2008 20:36:04 +0100
Local: Mon, Dec 15 2008 2:36 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login
sorry but (look other msg) I find another way to do Openid
authentification with google !

2008/12/15 Breno <breno.demedei...@gmail.com>:

--
Cordialement
David TREBOSC

http://www.bdpv.fr - Base de données de production photovoltaïque
http://photovoltaique.pureforum.net - Forum Photovoltaïque
http://www.macoda.com/index.php/Maison:Solaire_Photovoltaique Mon
installation Photovoltaïque !

http://www.macoda.com - Wiki sur de nombreux autres sujets.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
icyleaf  
View profile  
 More options Jan 9 2009, 5:18 am
From: icyleaf <icyleaf...@gmail.com>
Date: Fri, 9 Jan 2009 02:18:59 -0800 (PST)
Local: Fri, Jan 9 2009 5:18 am
Subject: Re: Simple PHP Class for Google Federated Login
hi, i just try it and fonud a mistake that it always display "Warning:
DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as
input in E:\PHP\GoogleOpenID\GoogleOpenID.php on line 330". this is
because could not fetch content from https://www.google.com/accounts/o8/id.
then i using curl function fetch it again and return empty content...
what does it happen?

On Dec 12 2008, 1:19 am, apeace <ape...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dirk Balfanz  
View profile  
 More options Jan 10 2009, 9:27 pm
From: Dirk Balfanz <dirk.balf...@gmail.com>
Date: Sat, 10 Jan 2009 18:27:01 -0800
Local: Sat, Jan 10 2009 9:27 pm
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login
Have you tried fetching that URL from the command line (i.e.,
something like "curl https://www.google.com/accounts/o8/id")? It works
for me, which makes me think it might be a problem with your PHP
setup.

Dirk Balfanz
Software Engineer, Google Security


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
icyleaf  
View profile  
 More options Jan 12 2009, 12:47 am
From: icyleaf <icyleaf...@gmail.com>
Date: Sun, 11 Jan 2009 21:47:30 -0800 (PST)
Local: Mon, Jan 12 2009 12:47 am
Subject: Re: Simple PHP Class for Google Federated Login
I was using xampp on windows failed, but on Dreamhost successful.
Maybe something wrong with my PHP setup, but i add some codes below
for "curl_setop" then done.

curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_HEADER, false);

On Jan 11, 10:27 am, Dirk Balfanz <dirk.balf...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
icyleaf  
View profile  
 More options Jan 12 2009, 12:49 am
From: icyleaf <icyleaf...@gmail.com>
Date: Sun, 11 Jan 2009 21:49:16 -0800 (PST)
Local: Mon, Jan 12 2009 12:49 am
Subject: Re: Simple PHP Class for Google Federated Login
Oh, other error messages, after return $_GET data, no "openid_realm"
and "require_email" include $_GET data.

On Dec 12 2008, 1:19 am, apeace <ape...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Deepak G K  
View profile  
 More options Jan 20 2009, 2:26 am
From: Deepak G K <dgk...@gmail.com>
Date: Mon, 19 Jan 2009 23:26:57 -0800 (PST)
Local: Tues, Jan 20 2009 2:26 am
Subject: Re: Simple PHP Class for Google Federated Login
CAn any of you pls give me an example of how to use andrews
class.....im in urgent need of this. Its like im confused on how to
set the parameters. So if any of you can post a complete example which
illustrates the usage of this class it would be of great help

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
michaël  
View profile  
 More options Jan 21 2009, 7:05 pm
From: michaël <mic...@gmail.com>
Date: Wed, 21 Jan 2009 16:05:40 -0800 (PST)
Local: Wed, Jan 21 2009 7:05 pm
Subject: Re: Simple PHP Class for Google Federated Login
Hi Andrew,

Congratulations!

Really easy to use, I was struggling big time to get Google Federated
Login implemented on my site www.trip2B.com , and now it will work in
no time!

2 questions:
- Can you let us know when signature verification will be implemented?
I think this is important for security reasons.
- How come the email is returned only once, i.e. the first time a user
logs in? Is there a way to have google responding every time the email
address?

Thanks a lot for your extremely easy to use code!

Regards,

Michaël

On Dec 13 2008, 10:14 pm, Breno <breno.demedei...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Hayes  
View profile  
 More options Jan 21 2009, 7:50 pm
From: Eric Hayes <ejha...@ucdavis.edu>
Date: Wed, 21 Jan 2009 16:50:09 -0800 (PST)
Local: Wed, Jan 21 2009 7:50 pm
Subject: Re: Simple PHP Class for Google Federated Login
I added signature verification (both types, but my signature
calculation function is giving back the wrong answer--dumb
verification works fine though), error checking, and constants to the
original code.  I also made the following changes:

- Only verified responses are returned--if a response fails
verification, then response->getMode == "cancel"
- URL's need to be absolute (we are only supplying 2 URL's so absolute
removes any possible vagueness)
- No need for signature encryption since we are already using
transport layer encryption from SSL
- Instead of creating the request then redirecting, we do it all in
one step.  This should save us some processing power on the server
(prob not much, but still)
- There are several parameters needed to establish an association, so
these are returned in an array.  The expires key is the time that the
key expires (calculated upon request)
- If you save the handle then you can pass it back to the login() and
getResponse() functions.  I haven't figured out how to verify the
signature on the client side yet (my generated signatures do not match
those coming from google).  Maybe somebody could get this working?

I have included the following below:
- my source code
- my test file source code (inline)

SOURCE CODE (openid.php)
<?php
/* Google OpenID Class.  This class aims to make using Federated login
Lightweight (only this file is needed), secure, and easy to use.

        By Andrew Peace (http://www.andrewpeace.com/contact.html), Eric Hayes
(http://deployfx.com)
        Last Updated December 17, 2008

        ------------------------------------------------------------------
        HISTORY
        ------------------------------------------------------------------
        * 12/6/2008 - Original version created
        * 12/17/2008 - Code cleaned up, error handling/custom exception class
added, signature verification ("dumb validation") working

        ------------------------------------------------------------------
        NOTES
        ------------------------------------------------------------------
        * (PARTIALLY WORKING) Client side verification is not working yet.
The code is included (commented out), but the calculated hash is
different than the one Google returns
        * Absolute URL's will be used instead of relative ones (realm value
will be shortened in the response and handle objects)
        * Since Google's enndpoint is using transport layer encryption, there
is very little added benefit to additional enncryption

        USAGE:
        ------------------------------------------------------------------
        Setting Up Logins and Associations
        ------------------------------------------------------------------
        *** To setup an association ***
                try{
                        $assoc = GoogleOpenId::EstablishAssociation("http://
someWebsiteHere.com");
                }
                catch(exception $e){
                        // However you decide to handle the error...
                }

        *** To perform a login without an association ***
                GoogleOpenId::login("http://myrealm.com", "http://myrealm.com/
return_to.php", NULL,email=true|false);

        *** To perform a login with an association ***
        try{
                        $assoc = GoogleOpenId::EstablishAssociation("http://
someWebsiteHere.com");
                        GoogleOpenId::login("http://myrealm.com", "http://myrealm.com/
return_to.php", $assoc,email=true|false);
        }
        catch(exception $e){
                // However you decide to handle the error...
        }

        ------------------------------------------------------------------
        Return pages
        ------------------------------------------------------------------
        You will most likely want to put the return code on the "return_to"
page (wherever that may be...)

        *** To get the result of a response without an association ***
        $response = GoogleOpenId::getResponse();

        *** To access response with an association ***
        $assoc = ...code to retrieve stored association array (perhaps in a
database, session, file, or somewhere else...)
        $response = GoogleOpenId::getResponse($assoc);

        ------------------------------------------------------------------
        Response object functions
        ------------------------------------------------------------------
        If signature validation fails, then getMode() == "cancel", which is
defined by OpenId_2_0::MODE_CANCEL.
        The object returned from GoogleOpenId::getResponse() has the
following getters functions.

        $response->getMode()
        $response->getRealm()
        $response->getID()
        $response->getEmail()
  */

/* Specific Exception Class for Google OpenID  */
class GoogleOpenIdException extends exception{
        const INVALID_USER = 1;
        const INVALID_SIGNATURE = 2;
        const INVALID_URL = 3;
        const CURL_ERROR = 4;
        const INVALID_CALL = 5;

        public function __toString(){
                return __CLASS__ . "::[C-{$this->code}]: {$this->message}\n";
        }

}

/* OpenID 2.0 Specific Constants */
class OpenId_2_0{
        const ASSOC_TYPE = "assoc_type";
        const HANDLE = "assoc_handle";
        const EXPIRES = "expires_in";
        const MAC = "mac_key";
        const SESSION_TYPE = "session_type";
        const REALM = "realm";
        const IDENTITY = "http://specs.openid.net/auth/2.0/
identifier_select";
        const HEADER = "openid.";
        const MODE_ASSOCIATE = "associate";
        const MODE_CANCEL = "cancel";
        const MODE_RESULT = "id_res";
        const MODE_VERIFY = "check_authentication";
        const MODE_SYNC = "checkid_immediate";
        const MODE_ASYNC = "checkid_setup";
        const NS = "http://specs.openid.net/auth/2.0";
        const SHA1 = "HMAC-SHA1";
        const SHA1_BLOCKSIZE = 64;
        const SHA256 = "HMAC-SHA256";
        const NO_SESSION_ENCRYPTION = "no-encryption";
        const P_NS = "openid.ns";
        const P_CLAIMED_ID = "openid.claimed_id";
        const P_IDENTITY = "openid.identity";
        const P_RETURN = "openid.return_to";
        const P_REALM = "openid.realm";
        const P_HANDLE = "openid.assoc_handle";
        const P_MODE = "openid.mode";
        const P_ENDPOINT = "openid.op_endpoint";
        const P_NONCE = "openid.response_nonce";
        const P_ISVALID = "is_valid";
        const P_SIGNED = "openid.signed";
        const P_SIG = "openid.sig";
        const P_ASSOC_TYPE = "openid.assoc_type";
        const P_SESSION_TYPE = "openid.session_type";
        const P_MAC = "openid.mac_key";
        const P_EXPIRES = "openid.expires_in";

}

/* OpenID Attribute Exchange 1.0 Specific Constants */
class OpenId_AX_1_0{
        const NS = "http://openid.net/srv/ax/1.0";
        const MODE_FETCH = "fetch_request";

}

/* Google OpenId Class */
class GoogleOpenID{
        /* Google OpenId Specific Constants - Since these may differ by
implementation, I placed these constants here */
        const DISCOVERY_ENDPOINT = "https://www.google.com/accounts/o8/id";
        const EMAIL_ATTR = "email";
        const EMAIL_URI = "http://schema.openid.net/contact/email";
        const P_EXT_NS = "openid.ns.ext1";
        const P_EXT_MODE = "openid.ext1.mode";
        const P_EXT_EMAIL_TYPE = "openid.ext1.type.email";
        const P_EXT_REQ = "openid.ext1.required";
        const P_EXT_EMAIL_VALUE = "openid.ext1.value.email";

        /* Private Members - Response Parameters.  After a response has been
verified, these values will be set.  A response is only created for
verified responses that worked */
        private $realm = NULL; // the realm that the response refers to
        private $claimed_id = NULL; // the claimed id (documented as unique
to each realm)
        private $email = NULL; // the email address, if one was returned
        private $mode = NULL; // the mode of the response

        /* Setus up an association and return an associative array of the
results.  You can refer to the fields by these keys:
                                OpenId_2_0::REALM => The realm of the established association
                                OpenId_2_0::ASSOC_TYPE => The association type (right now it seems
to be HMAC-SHA1)
                                OpenId_2_0::HANDLE => The handle used to refer to the association
                                OpenId_2_0::MAC => The MAC key.  This is used to verify the
signature
                                OpenId_2_0::SESSION_TYPE => Since Google is on SSL, this defaults
to "no-encryption"
        */
        static public function EstablishAssociation($realm){
                // Realm must be valid before we continue any further
                if( !GoogleOpenId::validRealm($realm) ){
                        throw new GoogleOpenIdException("Invalid realm used when
establishing association",GoogleOpenIdException::INVALID_URL);
                }

                //Set all necessary parameters
                $params =       OpenId_2_0::P_NS . "=" . urlencode(OpenId_2_0::NS) .
                                        "&" . OpenId_2_0::P_MODE . "=" . OpenId_2_0::MODE_ASSOCIATE .
                                        "&" . OpenId_2_0::P_ASSOC_TYPE . "=" . OpenId_2_0::SHA1 .
                                        "&" . OpenId_2_0::P_SESSION_TYPE . "=" .
OpenId_2_0::NO_SESSION_ENCRYPTION .
                                        "&" . OpenId_2_0::P_REALM . "=" . urlencode($realm);

                $GoogleEndpoint = GoogleOpenId::getEndpoint();

                $ch = curl_init($GoogleEndpoint);
                curl_setopt($ch, CURLOPT_HEADER, false);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); //verify Google's
certificate
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_VERBOSE, true);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

                // Get the current time
                $now = time();

                // Run it
                $response = curl_exec($ch);

                // If cURL did not execute correctly, throw an error
                if( $response == false ){
                        throw new GoogleOpenIdException(curl_error($ch),
GoogleOpenIdException::CURL_ERROR);
                }
                curl_close($ch);

                $lines = explode("\n", $response);
                $result = array(OpenId_2_0::REALM => GoogleOpenId::constructRealm
($realm) );

                foreach( $lines as $line ){
                        if( strlen($line) == 0 ) break;

                        $params = explode(":", $line);

                        switch( $params[0] ){
                                case OpenId_2_0::ASSOC_TYPE :
                                case OpenId_2_0::HANDLE :
                                case OpenId_2_0::MAC :
                                case OpenId_2_0::SESSION_TYPE :
                                        $result[$params[0]] = $params[1];
                                        break;
                                case OpenId_2_0::EXPIRES :
                                        $result[$params[0]] = $params[1] + $now;
                                default:
                                        // We don't care about other parameters right now, so do nothing
                        }
                }

                return $result;
        }

        /* setup the login and redirect */
        static public function login($realm, $return_to, $handle=NULL,
$getEmail){
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tskarthi2...@gmail.com  
View profile  
 More options Jan 23 2009, 11:37 am
From: tskarthi2...@gmail.com
Date: Fri, 23 Jan 2009 08:37:07 -0800 (PST)
Local: Fri, Jan 23 2009 11:37 am
Subject: Re: Simple PHP Class for Google Federated Login
Hi,

Have anyone successfully implemented Andrew class ? I am looking for a
way to implement this. I would appreciate if anyone shed some light on
this. Please let me know.

Thanks,
Karthi

On Jan 21, 7:50 pm, Eric Hayes <ejha...@ucdavis.edu> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Saleha A Latif  
View profile  
 More options Jan 24 2009, 7:12 am
From: Saleha A Latif <salehala...@gmail.com>
Date: Sat, 24 Jan 2009 13:12:31 +0100
Local: Sat, Jan 24 2009 7:12 am
Subject: Re: [google-federated-login-api] Re: Simple PHP Class for Google Federated Login

yes i did.
But not for yahoo:( Is their any1 help me to get yahoo user email address.

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sansbacon  
View profile  
 More options Feb 12 2009, 1:56 pm
From: sansbacon <sansba...@gmail.com>
Date: Thu, 12 Feb 2009 10:56:08 -0800 (PST)
Local: Thurs, Feb 12 2009 1:56 pm
Subject: Re: Simple PHP Class for Google Federated Login
I received the following error when I request test_login.php:

Fatal error: Uncaught GoogleOpenIdException::[C-3]: Invalid URL use in
login function thrown in GoogleOpenId.php on line 247

the parameters I used were http://www.[mydomain].com,
http://www.[mydomain].com/test_return.php, NULL, true

thanks!

eric truett

On Jan 24, 6:12 am, Saleha A Latif <salehala...@gmail.com> wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
numantah...@gmail.com  
View profile   Translate to Translated (View Original)
 More options Jul 5 2012, 9:15 am
From: numantah...@gmail.com
Date: Thu, 5 Jul 2012 06:15:04 -0700 (PDT)
Local: Thurs, Jul 5 2012 9:15 am
Subject: Re: Simple PHP Class for Google Federated Login


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »