Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-11-09 11:10:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
518d1156d0111aa48543285935d56e8a908615f0
518d1156
1 parent
dfc08554
1.使用谷歌服务账号进行验证
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
20 deletions
app/Payment/GooglePayment.php
app/Payment/GooglePayment.php
View file @
518d115
...
...
@@ -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
(
$c
onfigJson
);
$client
->
setAuthConfig
(
$c
redentials_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
;
}
...
...
Please
register
or
login
to post a comment