rameez-bhat / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
0 stars 0 forks source link

Как увеличить время жизни токена получаемого при OAuth 2.0 авторизации #390

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. авторизация методом получения access_token
2.
3.

What is the expected output? What do you see instead?

{"access_token": "ya29. 
AHES6ZSll__i1Ku5jUpMfY1UfnykjxpOJRQFWV5kGMxTMyBysIT8sQ", "token_type": 
"Bearer", "expires_in": 3600, "refresh_token": 
"1/N7CW9sZ3oLz3bj72Y2FggKzObJuiH0A8SwR0-KX1zFY", "created": 1378829922} 

What version of the product are you using? On what operating system?

OAuth 2.0

Please provide any additional information below.

Программа сама будет собирать данные с Google 
Analytics раз в день, как вы понимаете это 
невозможно сделать, если нужно постоянно 
просить авторизоваться, а именно запрос на 
дачу разрешений программы у пользователя. 
Как сделать так чтоб один раз получил 
доступ  (access_token) и более не запрашивать его 
каждый час?

Спасибо за ответ. 

Original issue reported on code.google.com by stat.kup...@gmail.com on 11 Sep 2013 at 6:04

GoogleCodeExporter commented 8 years ago
В вашем распоряжении есть isAccessTokenExpired() и 
refreshToken(refresh_token). Предполагается, что по 
истечении срока действия токена вы 
обновите его с помощью  refresh_token, 
полученного вместе с токеном при 
авторизации. Также обратите внимание на то, 
что refresh_token высылается только в том случае, 
если параметр access_type в запросе 
(генерируемом createAuthUrl) равен offline 
(установлен по умолчанию в PHP-библиотеке, но 
может отличаться в других).

про использование OAuth2 у гугла можно 
почитать тут:
https://developers.google.com/accounts/docs/OAuth2WebServer 

Original comment by nyao7...@gmail.com on 19 Sep 2013 at 12:03

GoogleCodeExporter commented 8 years ago
This issue tracker is now closing. Development on the Google PHP client library 
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has 
reached beta status there will be no further releases of the 0.6 branch of the 
library. 

Please take a look at the latest version on 
https://github.com/google/google-api-php-client

For information on migrating, please take a look at this guide: 
https://developers.google.com/api-client-library/php/guide/migration

For general library support please ask a question on StackOverflow: 
http://stackoverflow.com/questions/tagged/google-api-php-client

If you are looking for support with a specific API, please contact the team 
working with that API via StackOverflow or their preferred support mechanism. 

If your issue still exists with the new version of the library, please raise a 
bug in the GitHub issue tracker with a minimal code sample. 

Thanks!

Original comment by ianbar...@google.com on 22 Jan 2014 at 4:53