langbung01 icon

code revoke

langbung01 | PRO | 05/09/19 07:51:45 AM UTC | 0 ⭐ | 610 👁️ | Never ⏰ | []
PHP |

750 B

|

None

|

0 👍

/

0 👎

 public function oauthLogout(Request $request){
        $id = Auth::id();
        $client_id = auth()->user()->Token()->getAttribute('client_id');
        $find_client = $this->oauth->getOauthWithId($client_id);
 
        $access_token = Auth::user()->token();
        DB::table('oauth_access_tokens')
            ->where('id', $access_token->id)
            ->where('client_id', $access_token->client_id)
            ->where('user_id', $id)
            ->update([
                'revoked' => true
            ]);
        DB::table('oauth_refresh_tokens')
            ->where('access_token_id', $access_token->id)
            ->update([
                'revoked' => true
            ]);
        return redirect($find_client['redirect']);
    }

Comments