Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
pdf-customizer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ecb59079
authored
2016-10-04 20:20:36 -0400
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
eee
1 parent
8dd15865
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletions
app/Http/Controllers/GoogledriveuploadpdfController.php
app/Http/routes.php
app/Http/Controllers/GoogledriveuploadpdfController.php
View file @
ecb5907
...
...
@@ -258,4 +258,58 @@ public function isGoogleFolderCreated($cust_id)
}
public
function
GoogleTokenCode
(
$code
)
{
session_start
();
$client
=
new
\Google_Client
();
$client
->
setScopes
(
array
(
'https://www.googleapis.com/auth/drive.file'
));
$client
->
setClientId
(
'206523860143-kgs80emhfm1sof79nggd48gnhbl1j6ei.apps.googleusercontent.com'
);
$client
->
setClientSecret
(
'ZzEE02Dqz7AKJLSklmL30LNd'
);
$client
->
setRedirectUri
(
'https://pdf-customizer.synapsus.co/auth/google/tokenCallback'
);
$client
->
setAccessType
(
'offline'
);
$client
->
setApprovalPrompt
(
'force'
);
$client
->
authenticate
(
$_GET
[
'code'
]);
$_SESSION
[
'token'
]
=
$client
->
getAccessToken
();
if
(
isset
(
$_SESSION
[
'token'
]))
{
$client
->
setAccessToken
(
$_SESSION
[
'token'
]);
}
if
(
isset
(
$_REQUEST
[
'logout'
]))
{
unset
(
$_SESSION
[
'token'
]);
$client
->
revokeToken
();
}
?>
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
</head>
<body>
<header><h1>
Get Token
</h1></header>
<?php
$_SESSION
[
'token'
]
=
$client
->
getAccessToken
();
$token
=
json_decode
(
$_SESSION
[
'token'
]);
echo
"Access Token = "
.
$token
->
access_token
.
'<br/>'
;
echo
"Refresh Token = "
.
$token
->
refresh_token
.
'<br/>'
;
echo
"Token type = "
.
$token
->
token_type
.
'<br/>'
;
echo
"Expires in = "
.
$token
->
expires_in
.
'<br/>'
;
//echo "ID Token = " . $token->id_token . '<br/>';
echo
"Created = "
.
$token
->
created
.
'<br/>'
;
echo
"<a class='logout' href='?logout'>Logout</a>"
;
}
}
\ No newline at end of file
...
...
app/Http/routes.php
View file @
ecb5907
...
...
@@ -50,4 +50,4 @@ Route::post('fileentry/add',[ 'as' => 'addentry', 'uses' => 'FileEntryController
Route
::
get
(
'api/googlePdfUpload/{folder}/{filename}/{pdfid}/{id}'
,
'GoogledriveuploadpdfController@google_drive_upload'
);
Route
::
get
(
'auth/google/callback'
,
'GoogledriveuploadpdfController@google_drive_upload'
);
Route
::
get
(
'auth/google/token'
,
'GoogledriveuploadpdfController@GoogleToken'
);
Route
::
get
(
'auth/google/tokenCallback'
,
'GoogledriveuploadpdfController@GoogleToken'
);
\ No newline at end of file
Route
::
get
(
'auth/google/tokenCallback/{code}'
,
'GoogledriveuploadpdfController@GoogleTokenCode'
);
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment