我正在尝试为我的网站设置Google OAuth,但是当从XDebug读取我的会话时,我只有一个名为'token',其中包含以下json:
{"access_token":"ya29.Ci-IA6fojB-Q8EpBY1klxrJ-YmEPW66nn6uT5HDYiWcbuuqfPPBaCLkKbRhntkcfJg","expires_in":3600,"id_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjgxMzIxMjcyNDliMjE3ZGVhYTczY2VmMzY4MDlmNWQ0YmE5YTY2ODMifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiaWF0IjoxNDc3NDkzMTMxLCJleHAiOjE0Nzc0OTY3MzEsImF0X2hhc2giOiI3MWpTeGlVRzZBb3lsTFBubmZSaXJBIiwiYXVkIjoiMTAwNzI3NjY3NTMzNC1yczIycmtqamI4YXAxa3VkbGRiYmFkYmthc29zNWE4ZC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsInN1YiI6IjEwMDc5NTc2NzYxNzg3MjkwNzIwNCIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhenAiOiIxMDA3Mjc2Njc1MzM0LXJzMjJya2pqYjhhcDFrdWRsZGJiYWRia2Fzb3M1YThkLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiZW1haWwiOiJtYXR0aGV3LmJldG9uQGdtYWlsLmNvbSJ9.gbbEXfnnYR44qwEr_im9PMG9slhf014MHrvODmW7fZxmeTHCVhJgogP7GD4goqJHZxWc9CWYGdxwaqNnF9GJOCzdtd9zIzrixyAaHQizeAS5qNaxpMz_pM-NlsJLdSPOxtbkE6R_b1f2minkx0l1lyl0N23kOWt2j6asQ40N6Mv-AGZXHDjMwaNR2rMkZxe_7jy1vwYLC6UWWY6i0ngObRztp2XNZbIudlxzhmGU24TCVCkPcXQgzt2yitp98WnsoqswhniBFZHn7GtE_Fu7FcCRWZqtrXZMhxh0cNTSKQFpC-N4rX2eOR_e3fHyi-tZf0Rs2fOA-eUlDLlfgwPItg","refresh_token":"1\/3fK7kUyVLQEzmD1-xInEgki3sgcw79axalzldRznZq8","token_type":"Bearer","created":1477493130}
我设置的会话被称为'access_token',如下所示:
$_SESSION['access_token'] = $client->getAccessToken();
但是当我isset($_SESSION['access_token']
时,它返回false。有谁知道为什么会这样?以这种格式设置令牌是否正常?
设置会话的完整代码(login.php):http://pastebin.com/F0S5fWyt 检查会话的位置(index.php):http://pastebin.com/YxCUpjFF