src/Synapse/OAuth2/OAuthController.php
public function logout(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        $securityToken = $this->security->getToken();
        $user          = $securityToken->getUser();
        $accessToken   = $securityToken->getOAuthToken();
        $refreshToken  = Arr::get($content, 'refresh_token');

        $this->session->set('user', null);

        if (! $refreshToken) {
            return new Response('Refresh token not provided', 422);
        }

        try {
            $this->expireAccessToken($accessToken);
            $this->expireRefreshToken($refreshToken, $user);
        } catch (OutOfBoundsException $e) {
            return new Response($e->getMessage(), 422);
        }

        return new Response('', 200);
    }
public function logout(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        $securityToken = $this->security->getToken();
        $user          = $securityToken->getUser();
        $accessToken   = $securityToken->getOAuthToken();
        $refreshToken  = Arr::get($content, 'refresh_token');

        $this->session->set('user', null);

        if (! $refreshToken) {
            return new Response('Refresh token not provided', 422);
        }

        try {
            $this->expireAccessToken($accessToken);
            $this->expireRefreshToken($refreshToken, $user);
        } catch (OutOfBoundsException $e) {
            return new Response($e->getMessage(), 422);
        }

        return new Response('', 200);
    }
public function logout ( Request $ request ) { $ content = json_decode ( $ request -> getContent ( ) , true ) ; $ securityToken = $ this -> security -> getToken ( ) ; $ user = $ securityToken -> getUser ( ) ; $ accessToken = $ securityToken -> getOAuthToken ( ) ; $ refreshToken = Arr :: get ( $ content , 'refresh_token' ) ; $ this -> session -> set ( 'user' , null ) ; if ( ! $ refreshToken ) { return new Response ( 'Refresh token not provided' , 422 ) ; } try { $ this -> expireAccessToken ( $ accessToken ) ; $ this -> expireRefreshToken ( $ refreshToken , $ user ) ; } catch ( OutOfBoundsException $ e ) { return new Response ( $ e -> getMessage ( ) , 422 ) ; } return new Response ( '' , 200 ) ; }
Handle logout request

@param  Request $request
@return Response
Handle logout request