Issue regarding OAuth 2.0 in Provisionig Api

For programming and general questions on Zend Framework

Issue regarding OAuth 2.0 in Provisionig Api

Postby gajendrajain on Mon Oct 29, 2012 12:44 pm

Hi,

I am implementing provisioning api with auth 2.0. But i did not found any solution or post how to implement Outh 2.0 with provisioning api. Check my code what i did now for impelmnting OAuth 2.0.

Code: Select all
$domain='                  ';
if(JRequest::getVar('code'.'')=='')
         {
            $auth_uri='https://accounts.   .com/o/oauth2/auth?client_id=   &redirect_uri='.JURI::base().'index.php?option=com_provision%26task%3Duser.import&scope=https://apps-apis.   .com/a/feeds/groups/+https://apps-apis.   .com/a/feeds/user/&response_type=code';
            header("HTTP/1.0 307 Temporary redirect");
   
              header("Location: " . $auth_uri);
      
              exit();
         }
         else
         {
                     
                $auth_uri='https://accounts.    .com/o/oauth2/token?scope=https://apps-apis.    .com/a/feeds/group/2.0/domain/+https://apps-apis.     .com/a/feeds/user/2.0/domain/&response_type=code';
            $client = new Zend_Http_Client($auth_uri,array( 'maxredirects' => 0, 'timeout'      => 30));
             $client->setMethod(Zend_Http_Client::GET);
                $client->setHeaders('Content-Type: application/x-www-form-urlencoded');
              $client->setRawData(array( 'code' => JRequest::getVar('code'.''),'client_id' =>   ','client_secret' => '    ','redirect_uri' =>JURI::base().'index.php?option=com_provision&task=user.import','grant_type' => 'authorization_code'));
              $response = $client->request();             
               
              $gdata = new Zend_Gdata_Gapps($client, $domain);             
             $feed = $gdata->retrieveAllUsers();
             
                 print_r($feed);
             exit;     
             
         }

When i am priniing this print_r($feed); I got an error

Expected response code 200, got 401
Authorization required
Error 401.

Can you provide some sample code or help. How can i implement provisioning api with OAuth2.0.

Any reply will be thank Full.
gajendrajain
 
Posts: 1
Joined: Mon Oct 29, 2012 12:23 pm

Re: Issue regarding OAuth 2.0 in Provisionig Api

Postby nish2378 on Thu Jan 11, 2018 6:44 pm

Hello Guys, We all are playing bingo bash now a days, So get free bingo bash chips and make this gaming more interesting.
nish2378
 
Posts: 2
Joined: Wed Jan 10, 2018 4:45 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 5 guests