単一ページ (javascript) アプリケーションで Google HTML サインイン ボタンを使用して、Google ログインを持つユーザーから認証オブジェクトを取得しています。これについては、https ://developers.google.com/+/web/signin/add-button で詳しく説明しています。
以下に示すようなトークンを正常に受け取りました。このトークンは 1 時間で期限切れになるため、ユーザーがログアウトするまで、約 30 分ごとにトークンを更新する必要があります。私は電話してこれを試みています:
gapi.auth.authorize({client_id: "90... ...92.apps.googleusercontent.com", scope: "profile email", immediate: true}, function() { console.log( arguments ); } );
しかし運がない。有効期限が切れるまで同じトークンを受け取り、その後は空の (サインインしていない) トークンを受け取ります。ユーザーが継続的に再度ログインしなくても、ベアラートークンを保持/更新するにはどうすればよいですか?
{
_aa: "1"
access_token: "ya29.1.AA... ...BByHpg"
authuser: "0"
client_id: "90... ...92.apps.googleusercontent.com"
code: "4/Nyj-4sVVcekiDnIgMFh14U7-QdRm.svPMQSODiXMbYKs_1NgQtmX9F90miwI"
cookie_policy: "single_host_origin",
expires_at: "1398341363",
expires_in: "3600",
g_user_cookie_policy: undefined,
id_token: "eyJhbGciOiJ... ...0Es1LI"
issued_at: "1398337763",
num_sessions: "2",
prompt: "none",
response_type: "code token id_token gsession",
scope: "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
session_state: "b92d67080... ...73ae",
state: "",
status: {
google_logged_in: true,
method: "AUTO",
signed_in: true
},
token_type: "Bearer"
}