Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6947357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:40:59+00:00 2026-05-27T13:40:59+00:00

I got a little problem with the OAuth for Google, I use the Jim

  • 0

I got a little problem with the OAuth for Google, I use the Jim Saunder Libraire for CodeIgniter (http://codeigniter.com/wiki/OAuth_for_Google) but when I came to my access_youtube function, which look like that :

public function access_youtube()
{ //STEP 2

// Here is the first call to load the library 
    $params['key'] = 's390075769.onlinehome.fr';
    $params['secret'] = 'iHD72YKzWmbm8VTwncht_E-d';

// We  can change the signing algorithm and http method by setting the following in your params array.
    $params['algorithm'] = 'HMAC-SHA1';
    // $params['method'] = "GET";

// We need to reload the library since we left our site beetween Step 1 & 2.
    $this->load->library('google_oauth', $params);

// We are using HMAC signing you need to specify the token_secret you got from the request step as the second parameter of this method. So
    $token_secret = $this->session->userdata('token_secret');
    $oauth = $this->google_oauth->get_access_token(false, $token_secret);

// The access method will return an array with keys of ‘oauth_token’, and ‘oauth_token_secret’ 
// These values are your access token and your access token secret. We should store these in our database.  
    $this->session->set_userdata('oauth_token', $oauth['oauth_token']);
    $this->session->set_userdata('oauth_token_secret', $oauth['oauth_token_secret']);

// Now you have an access token and can make google service requests on your users behalf
    redirect(site_url());
}

I got several error messages :

Undefined index: oauth_token

Undefined index: oauth_token_secret

which refer to the lines $this->session->set_userdata …

and, after each error message I get :

Message: Cannot modify header information – headers already sent by (output started at /homepages/7/d390075755/htdocs/system/core/Exceptions.php:170)
Filename: libraries/Session.php
Line Number: 671

which, I think is linked with the previous error message.

so I tried that in the constructor :

class Example extends CI_Controller
{
private $CI;
public function __construct()
{
     parent::__construct();

    $this->CI =& get_instance();
    $this->CI->load->library('session');

    $oauth = array();
    $oauth['oauth_token_secret']='';
    $oauth['oauth_token']='';

}

just before my function but it doesn’t do anything .. and I’m affraid I’m gonna loose my session variables stock by google … isn’t it ? Do I get my tokens from google ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:41:00+00:00Added an answer on May 27, 2026 at 1:41 pm

    Honestly i am not sure how Session will be managed by PHP code so will be of little help for you.
    It seems that this line is the cause

    $oauth = $this->google_oauth->get_access_token(false, $token_secret);
    

    you are trying to get access_token from the Google to send request to Google API to get user information who ever authorize your application and i guess Google is not returning what has been expected from them.
    this can be due to type mismatch in the request data as what Google Oauth is expecting from you and what actually you are sending

    In you case i would have used debugger of my Eclipse to see what exactly is going on but for OAuth i already told you in earlier question

    1. You need to store that token you getting at your first step.
    2. Once your user is back from authenticate them-self you need to get access_token using that request token
    3. Once you have request token you are ready to make final API call and it seems that some how your code is failing to get the data from session
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a little problem using the CodeIgniter route function. I use the
Got a little problem i asked about it before but maybe i didnt ask
I got a little problem, what I think, can't be hard. but somehow, I
I got a little problem with a JOptionPane which I use to warn user
I've got a little problem. my application runs without problems in Debug mode, but
I got a little problem with ViewBag and DropDownListFor. Code below Working fine but
I'm working on a fairly simple console application but I got one little problem.
I've got a little problem with uitextfield. I use two of them in a
I've got a little problem with UserScripts in Google Chrome, to be precise with
i`ve got a little problem with LINQ. I read out some information via XML-RPC.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.