2

Google リーダーから OAuth2 を介して購読リストを取得しようとしています。私は Codeigniter とライブラリ - CI_OPAUTHを使用しています。問題なくアクセス許可画面を取得し、Google リーダーのアクセス許可を付与できます。問題は、認証が完了した後にコールバック ヘッダーを取得すると、403 Forbidden ヘッダーが表示されることです。

ライブラリのオプションは次のとおりです。

    $config['opauth_config'] = array(
    'path' => '/mixordia/index.php/oauth/login/', //example: /ci_opauth/auth/login/
    'callback_url' => '/mixordia/index.php/oauth/authenticate/', //example: /ci_opauth/auth/authenticate/
    'callback_transport' => 'get', //Codeigniter don't use native session
    'security_salt' => 'mixordias_salt_whwhwh_wayacross',
    'debug' => true,
    'Strategy' => array(
        'Google' => array(
            'client_id' => 'MY_ID',
            'client_secret' => 'MY_SECRET',
            'service' => 'reader',
            'source' => 'APP Name',
            'scope' => 'http://www.google.com/reader/api'
        )
    )
);

ここに私が得るものがあります:

Array
(
[error] => Array
    (
        [provider] => Google
        [code] => userinfo_error
        [message] => Failed when attempting to query for user information
        [raw] => Array
            (
                [response] => 0
                [headers] => HTTP/1.0 403 Forbidden
WWW-Authenticate: Bearer realm="https://www.google.com/accounts/AuthSubRequest",     error=insufficient_scope, scope="https://www.googleapis.com/auth/userinfo.id h ttps://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.login https://www.google.com/accounts/OAuthLogin"
Content-Type: application/json; charset=UTF-8
Date: Thu, 13 Jun 2013 12:26:25 GMT
Expires: Thu, 13 Jun 2013 12:26:25 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
            )

    )

[timestamp] => 2013-06-13T12:26:25+00:00
)

私はこれに2日間立ち往生しており、ライブラリへのリクエストで何が間違っているのかわかりません。手伝って頂けますか?

4

1 に答える 1

1

ライブラリはuser's profile を取得しようとしますが、これには userinfo.profile スコープ ( https://www.googleapis.com/auth/userinfo.profile ) が必要です。そのスコープを構成に追加すると、機能するはずです。

于 2013-08-26T23:52:33.373 に答える