I would like to use Google OAuth in my cakePHP application to let the users login with their google account. I looked at the following component: http://code.42dh.com/oauth/ . Somehow I am not able to get it up and working. I don't know what I am doing wrong. I registered my application on the Google registration form and got my Consumer key and Consumer secret. I added it in the consumer component. I still don't get it to work.

Here is my code:

<?php

class ExampleController extends AppController {
public $uses = array();
var $helpers = array('Javascript', 'Ajax');
public $components = array('OauthConsumer');

public function google() {

    $scope = "https://www.google.com/m8/feeds/";
    $REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken?scope=' . urlencode($scope);

    $requestToken = $this->OauthConsumer->getRequestToken('Google', $REQUEST_TOKEN_URL, 'http://mydomain.com/example/google_callback');
    $this->Session->write('google_request_token', $requestToken);
    $this->redirect('https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=' . $requestToken->key);
}

public function google_callback() {
    $requestToken = $this->Session->read('google_request_token'); 
    $accessToken = $this->OauthConsumer->getAccessToken('Google',   'https://www.google.com/accounts/OAuthGetAccessToken', $requestToken); 

 }
 }

 ?>

When I try to request the requestToken I get the answes: "signature invalid".

Did someone use Google OAuth within their cakePHP application and would be willing to give me some tips?

Edit
Report