Archive for November, 2013

Developer Registration

Generating Access Token

1. https://code.google.com/apis/youtube/dashboard/gwt/index.html  (Developer Key-Google)

Create Project

1. https://code.google.com/apis/console

2.  API Project -> Services -> Add Services (Youtube, Google Plus, Picasa, Google Maps)

3. Youtube (YouTube Data API v3 and YouTube Analytics API )

4. API Access

  • Create Oauth 2.0 Client ID
  • Client ID Setting
    1. Web Application
    2. Site URL (htp://localhost of http://www.example.com)
    3. Redirection URL
  • Generated Client ID and Secret
  • Client ID:
    xxxxxxxxxxxx.apps.googleusercontent.com
    Email address:
    xxxxxxxxxxxx@developer.gserviceaccount.com
    Client secret: xxxxxxxxxxxx
    Redirect URIs: http://localhost/projectname
    JavaScript origins: http://localhost

 

Refereed By : Google API’s

Advertisements

1. Request to Youtube using API

public function request_youtube()
 {
 $params['key'] = xxxxxxxxxxxx.apps.googleusercontent.com';
 $params['secret'] = 'xxxxxxxxxxxx';
 $params['algorithm'] = 'HMAC-SHA1';
$this->load->library('google_oauth', $params);
 $data = $this->google_oauth->get_request_token(base_url().'index.php/example/access_youtube');
 $this->session->set_userdata('token_secret', $data['token_secret']);
 redirect($data['redirect']);
 }

2. Access

public function access_youtube()
 {
 $params['key'] = xxxxxxxxxxxx.apps.googleusercontent.com';
 $params['secret'] = 'xxxxxxxxxxxx';
 $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().'index.php/controller/method');
 }

Refereed By : Google API’s