public function validateAuthCode($clientId, $redirectUri, $authCode)
    {
        $result = DB::table('oauth_sessions')
                    ->select('oauth_sessions.id as session_id', 'oauth_session_authcodes.id as authcode_id')
                    ->join('oauth_session_authcodes', 'oauth_sessions.id', '=', 'oauth_session_authcodes.session_id')
                    ->join('oauth_session_redirects', 'oauth_sessions.id', '=', 'oauth_session_redirects.session_id')
                    ->where('oauth_sessions.client_id', $clientId)
                    ->where('oauth_session_authcodes.auth_code', $authCode)
                    ->where('oauth_session_authcodes.auth_code_expires', '>=', time())
                    ->where('oauth_session_redirects.redirect_uri', $redirectUri)
                    ->first();

        return (is_null($result)) ? false : (array) $result;
    }
public function validateAuthCode($clientId, $redirectUri, $authCode)
    {
        $result = DB::table('oauth_sessions')
                    ->select('oauth_sessions.id as session_id', 'oauth_session_authcodes.id as authcode_id')
                    ->join('oauth_session_authcodes', 'oauth_sessions.id', '=', 'oauth_session_authcodes.session_id')
                    ->join('oauth_session_redirects', 'oauth_sessions.id', '=', 'oauth_session_redirects.session_id')
                    ->where('oauth_sessions.client_id', $clientId)
                    ->where('oauth_session_authcodes.auth_code', $authCode)
                    ->where('oauth_session_authcodes.auth_code_expires', '>=', time())
                    ->where('oauth_session_redirects.redirect_uri', $redirectUri)
                    ->first();

        return (is_null($result)) ? false : (array) $result;
    }
public function validateAuthCode ( $ clientId , $ redirectUri , $ authCode ) { $ result = DB :: table ( 'oauth_sessions' ) -> select ( 'oauth_sessions.id as session_id' , 'oauth_session_authcodes.id as authcode_id' ) -> join ( 'oauth_session_authcodes' , 'oauth_sessions.id' , '=' , 'oauth_session_authcodes.session_id' ) -> join ( 'oauth_session_redirects' , 'oauth_sessions.id' , '=' , 'oauth_session_redirects.session_id' ) -> where ( 'oauth_sessions.client_id' , $ clientId ) -> where ( 'oauth_session_authcodes.auth_code' , $ authCode ) -> where ( 'oauth_session_authcodes.auth_code_expires' , '>=' , time ( ) ) -> where ( 'oauth_session_redirects.redirect_uri' , $ redirectUri ) -> first ( ) ; return ( is_null ( $ result ) ) ? false : ( array ) $ result ; }
Validate an authorization code

Example SQL query:

<code>
SELECT oauth_sessions.id AS session_id, oauth_session_authcodes.id AS authcode_id FROM oauth_sessions
JOIN oauth_session_authcodes ON oauth_session_authcodes.`session_id` = oauth_sessions.id
JOIN oauth_session_redirects ON oauth_session_redirects.`session_id` = oauth_sessions.id WHERE
oauth_sessions.client_id = :clientId AND oauth_session_authcodes.`auth_code` = :authCode
AND `oauth_session_authcodes`.`auth_code_expires` >= :time AND
`oauth_session_redirects`.`redirect_uri` = :redirectUri
</code>

Expected response:

<code>
array(
'session_id' =>  (int)
'authcode_id'  =>  (int)
)
</code>

@param  string     $clientId    The client ID
@param  string     $redirectUri The redirect URI
@param  string     $authCode    The authorization code
@return array|bool              False if invalid or array as above
Validate an authorization code