李帅

1.使用谷歌服务账号进行验证

......@@ -39,38 +39,54 @@ class GooglePayment implements PaymentInterface
private function getGoogleClient()
{
// load our config.json that contains our credentials for accessing google's api as a json string
$configJson = public_path().'/client_secret_724392566830-jv6gqcb7vv8q9vavihhu5siccdit35op.apps.googleusercontent.com.json';
// // load our config.json that contains our credentials for accessing google's api as a json string
// $configJson = public_path().'/client_secret_724392566830-jv6gqcb7vv8q9vavihhu5siccdit35op.apps.googleusercontent.com.json';
//
// // define an application name
// $applicationName = 'Parlando一言临境';
//
// // create the client
// $client = new \Google_Client();
// $client->setApplicationName($applicationName);
// try{
// $client->setAuthConfig($configJson);
// }catch (\Google\Exception $exception){
// Log::debug('用户授权出错了'.$exception->getMessage());
// }
// $client->setAccessType('offline'); // necessary for getting the refresh token
// $client->setApprovalPrompt ('force'); // necessary for getting the refresh token
// // scopes determine what google endpoints we can access. keep it simple for now.
// $client->setScopes(
// [
// \Google\Service\Oauth2::USERINFO_PROFILE,
// \Google\Service\Oauth2::USERINFO_EMAIL,
// \Google\Service\Oauth2::OPENID,
// \Google_Service_AndroidPublisher::ANDROIDPUBLISHER,
// \Google\Service\Drive::DRIVE_METADATA_READONLY // allows reading of google drive metadata
// ]
// );
// $client->setIncludeGrantedScopes(true);
//
// // google 服务端默认获得受权
// $client->useApplicationDefaultCredentials();
// // 设置 google client_email
// $client->setSubject("client_email");
// define an application name
$applicationName = 'Parlando一言临境';
// create the client
$credentials_file = public_path().'/pc-api-7482901338487549764-603-566eccf76b91.json';
$client = new \Google_Client();
$client->setApplicationName($applicationName);
try{
$client->setAuthConfig($configJson);
$client->setAuthConfig($credentials_file);
}catch (\Google\Exception $exception){
Log::debug('用户授权出错了'.$exception->getMessage());
}
$client->setAccessType('offline'); // necessary for getting the refresh token
$client->setApprovalPrompt ('force'); // necessary for getting the refresh token
// scopes determine what google endpoints we can access. keep it simple for now.
$applicationName = 'Parlando一言临境';
$client->setApplicationName($applicationName);
$client->setScopes(
[
\Google\Service\Oauth2::USERINFO_PROFILE,
\Google\Service\Oauth2::USERINFO_EMAIL,
\Google\Service\Oauth2::OPENID,
\Google_Service_AndroidPublisher::ANDROIDPUBLISHER,
\Google\Service\Drive::DRIVE_METADATA_READONLY // allows reading of google drive metadata
]
);
// $client->setIncludeGrantedScopes(true);
// google 服务端默认获得受权
// $client->useApplicationDefaultCredentials();
// 设置 google client_email
// $client->setSubject("client_email");
return $client;
}
......