Permalink
Browse files

📝 Enable Google account deletion

  • Loading branch information...
lorisleiva committed Aug 17, 2018
1 parent a9ba39b commit bd25acbfd10a79c86b9a07a6373c65fd0314384b
Showing with 14 additions and 3 deletions.
  1. +6 −2 app/Http/Controllers/GoogleAccountController.php
  2. +8 −1 app/Services/Google.php
@@ -52,8 +52,12 @@ public function store(Request $request, Google $google)
/**
* Revoke the account's token and delete the it locally.
*/
public function destroy(GoogleAccount $googleAccount)
public function destroy(GoogleAccount $googleAccount, Google $google)
{
// TODO
$googleAccount->delete();
$google->revokeToken($googleAccount->token);
return redirect()->back();
}
}
View
@@ -18,14 +18,21 @@ function __construct()
$client->setIncludeGrantedScopes(config('services.google.include_granted_scopes'));
$this->client = $client;
}
public function connectUsing($token)
{
$this->client->setAccessToken($token);
return $this;
}
public function revokeToken($token = null)
{
$token = $token ?? $this->client->getAccessToken();
return $this->client->revokeToken($token);
}
public function service($service)
{
$classname = "Google_Service_$service";

0 comments on commit bd25acb

Please sign in to comment.