我正在構建一個門戶,多個用戶可以在其中登錄到他們的多個 Gmail 帳戶。我已成功檢索令牌值,但是,我想將其存儲在我的數(shù)據(jù)庫中,但我無法存儲它。下面是我正在使用的代碼:function mInititalize(){$client = new Google_Client();$client->addScope('https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://mail.google.com/'); $client->setClientId(Config('gmail.client_id'));$client->setClientSecret(Config('gmail.client_secret'));$client->setRedirectUri('http://localhost:81'.Config('gmail.redirect_url')); $loginURL = $client->createAuthUrl();return redirect($loginURL);}重定向或用戶登錄后function mGetToken(){ $token = $client->fetchAccessTokenWithAuthCode( 'code'); // here i get the 'code' from login URL I pass this code to get token I successfully get token $oAuth = new Google_Service_Oauth2( $client); $userData = $oAuth->userinfo_v2_me->get(); // get current user detail }我想將$token值存儲在數(shù)據(jù)庫中,但收到錯誤消息>Serialization of 'Closure' is not allowed請任何人幫我解決這個問題。謝謝。
將 Google OAuth 授權令牌存儲在數(shù)據(jù)庫中
慕碼人2483693
2022-10-14 14:33:58