Advertisement
langbung01

code revoke

May 9th, 2019
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1.  public function oauthLogout(Request $request){
  2.         $id = Auth::id();
  3.         $client_id = auth()->user()->Token()->getAttribute('client_id');
  4.         $find_client = $this->oauth->getOauthWithId($client_id);
  5.  
  6.         $access_token = Auth::user()->token();
  7.         DB::table('oauth_access_tokens')
  8.             ->where('id', $access_token->id)
  9.             ->where('client_id', $access_token->client_id)
  10.             ->where('user_id', $id)
  11.             ->update([
  12.                 'revoked' => true
  13.             ]);
  14.         DB::table('oauth_refresh_tokens')
  15.             ->where('access_token_id', $access_token->id)
  16.             ->update([
  17.                 'revoked' => true
  18.             ]);
  19.         return redirect($find_client['redirect']);
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement