2014-12-22 2 views
2

Я реализовал клиентскую сторону аутентификации/обеспечения/федерации OpenIDConnect для нескольких поставщиков OAuth2-OpenIdConnect. Но я не могу заставить Google OpenID People https://developers.google.com/+/api/openidconnect/getOpenIdConnect работать.Google OpenIdConnect People

У меня нет проблем с 1-й частью аутентификации/авторизации OpenID и без проблем получить токен Identity от JSONWEBtoken. Тем не менее я не могу получить доступ к $ identityApiUrl. Странно, что работает старый API userinfo google! Только ошибка с ошибкой авторизации завершается с ошибкой.

Для PeopleAPI я использовал токен-носитель, повторно использующий access_token, у меня есть запрос на авторизацию. Точно так же, как со старым API.

Здесь, после короткого извлечения из моего кода с URL-адресами и областями, которые я использовал, а также с ошибкой, я получаю при повторном воспроизведении вручную с помощью завитка запроса.

Вопросы:

  • Существует ли специальный метод аутентификации для OpenIdConnect People API?
  • Нужно ли запрашивать специальное разрешение в консоли приложения?

Выписка из кода с URL API,

// main IDP configuration URLs 
    protected $openidconnect = true; // Google supports OpenID-Connect 
    protected $authTokenUrl = 'https://accounts.google.com/o/oauth2/auth'; 
    protected $accessTokenUrl= 'https://www.googleapis.com/oauth2/v3/token'; 
    // I fail to get Google People OpenIdConnect API to work :(
    //protected $identityApiUrl= 'https://www.googleapis.com/plus/v1/people/me/OpenIdConnect'; 
    protected $identityApiUrl= 'https://www.googleapis.com/oauth2/v1/userinfo'; 

    // OAuth2 action-1: getAuthUrl($state) build authorization token url 
    protected $scopes = ['openid','email','profile']; // request authentication & email 

Код ошибки, когда Воспроизводятся запрос с завитком

[[email protected]zh GeoToBe]$ curl -X GET -H "Authorization: Bearer ya29.5ABSl_75eP_zYFho_E-wVjPlZJc1XfY398HZqJjMxvRxBEWteLKZwNeh2v0BPwWuoH1iLpESeBQvFw" https://www.googleapis.com/plus/v1/people/me/openIdConnect 
{ 
"error": { 
    "errors": [ 
    { 
    "domain": "usageLimits", 
    "reason": "accessNotConfigured", 
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.", 
    "extendedHelp": "https://console.developers.google.com" 
    } 
    ], 
    "code": 403, 
    "message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration." 
} 
} 

ответ

4

Вам необходимо включить "Google+ API" под API, & auth в консоли Google API.

+0

Спасибо за этот совет, теперь он работает. с https://www.googleapis.com/plus/v1/people/me/openIdConnect и https://www.googleapis.com/plus/v1/people/me – Fulup

Смежные вопросы