Zend_OpenId_Extension_Sreg (Open Id) problem

For programming and general questions on Zend Framework
Post Reply
cliburn
Posts: 3
Joined: Tue Apr 21, 2009 2:41 am

Zend_OpenId_Extension_Sreg (Open Id) problem

Post by cliburn » Tue Apr 21, 2009 2:52 am

Mabuhay!!

I used the method below to check whether the user using openid as login is valid or not. I request an email for every openid verification in return. If I use RPX, I see the email coming back and openid verification is valid. I f I use the method below, I always end up with an invalid verification. If I set email in Sreg false, I get a valid verification. Here's my code:

Code: Select all

// start - sabi nila pogi ako

        private function _processOpenId() {
		
		$status = "";
		
		if (isset($_POST['login_openid']) && $_POST['login_openid'] == "Login" && !empty($_POST['openid_identifier'])) {

			$consumer = new Zend_OpenId_Consumer();
		    
		    if (!$consumer->login($_POST['openid_identifier'])) {
		        
		    	$status = "OpenID login failed";
		    
		    } 
		   			   
		} else if (isset($_GET['openid_mode'])) {

			if ($_GET['openid_mode'] == "id_res") {
				
				$sreg = new Zend_OpenId_Extension_Sreg(
				
					array(
					    						
					    'email'	=> true
					
					), 
					null, 
					1.1
					
				);
		
   				$consumer = new Zend_OpenId_Consumer();
   
   				if ($consumer->verify($_GET, $id, $sreg)) {
			
   					$data = $sreg->getProperties();
   					
	   				if (isset($data['email'])) {
				        
	   					$this->_sOpenIdEmail = htmlspecialchars($data['email']);
	   					
				    }
   					
   					$status = "VALID"; 
   
   				} else {
	
   					$status = "INVALID ".htmlspecialchars($id);
   			
   				}
   
			} else if ($_GET['openid_mode'] == "cancel") {
 	
				$status = "CANCELLED";
      	
		    } 
		   				       
		}
		
		return $status;
		
	}

       // end - totoo naman yun a
[/color]

Cliburn M. Solano
Pinoy ako
clybs@yahoo.com

cliburn
Posts: 3
Joined: Tue Apr 21, 2009 2:41 am

Re: Zend_OpenId_Extension_Sreg (Open Id) problem

Post by cliburn » Sat Apr 25, 2009 7:46 am

ok, it's a long code. Basically, I would just like to have a working example of zend open Id actually getting the user's email which is publicly viewable. In RPX, I could easily get it, in Zend openid, I am having trouble though.

Thanks,
Cliburn M. Solano

Post Reply