Welcome Guest, Not a member yet? Register   Sign In
problem with google_oauth, youtube api, cant login when i upload files to the server, but working on localhost
#1

[eluser]Unknown[/eluser]
Hi, I have problem with my Youtube Api, precisely google_oauth.
Everything is working well on localhost, I am getting oauth_token and authorization process passes every time and I always manage to login with gmail or youtube credentials but problem was created when I uploaded my project to the server.Now I cant get oauth_token, secret and everything that is necessary for login with oauth.

When i try to login I get these errors that are not present when I login with my localhost project:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: key

Filename: libraries/google_oauth.php

Line Number: 88
A PHP Error was encountered

Severity: Notice

Message: Undefined index: secret

Filename: libraries/google_oauth.php

Line Number: 88
A PHP Error was encountered

Severity: Notice

Message: Undefined index: oauth_token

Filename: libraries/google_oauth.php

Line Number: 101
A PHP Error was encountered

Severity: Notice

Message: Undefined index: oauth_token_secret

Filename: libraries/google_oauth.php

Line Number: 104
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /---/---/---/system/core/Exceptions.php:185)

Filename: libraries/Session.php

Line Number: 672
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /---/---/---/system/core/Exceptions.php:185)

Filename: helpers/url_helper.php

Line Number: 546
______________________________

I've read a lot about last two errors regarding header information, and I tried everything, I checked for closing php tag, checked for white spaces,I read topics here as well about this header error but still this is not working.

Does anyone know what is causing these errors when I upload website and why aren't they showing in localhost?

I am using Codeigniter libraries for Youtube API and code of my functions are:

function request_youtube()
{
$params['oauth']['key'] = '.....';
$params['oauth']['secret'] = '.......';
$params['algorithm'] = 'HMAC-SHA1';

$this->load->library('google_oauth', $params);
$data = $this->google_oauth->get_request_token(base_url('home/access_youtube'));
$this->session->set_userdata('token_secret', $data['token_secret']);
redirect($data['redirect']);
}

function access_youtube()
{
$params['oauth']['key'] = '....';
$params['oauth']['secret'] = '......';
$params['algorithm'] = 'HMAC-SHA1';

$this->load->library('google_oauth', $params);

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

$this->session->set_userdata('oauth_token', $oauth['oauth_token']);
$this->session->set_userdata('oauth_token_secret', $oauth['oauth_token_secret']);

redirect(base_url('home'));
}

And could this be because of my hosting server, I mean some parameters forbidden or something like that?

Thanks in advance!
#2

[eluser]toopay[/eluser]
You dont forget to register your production domain, into your google api account right? Because not like facebook, which support wildcard domain, google only authorize domain which you register in your dashboard.
#3

[eluser]Unknown[/eluser]
Yes I registered domain on google, that shouldn't be the problem :S
#4

[eluser]toopay[/eluser]
Well, that the only problem that may occur in my case. Because if in the development environment it works, then nothing stop it works in production environment except that one(in google case).

Btw, try this one, since Google now support OAuth2, there no reason we stick with the old one.




Theme © iAndrew 2016 - Forum software by © MyBB