public function authorize()
    {
        $response = new Response();

        /** @var Response $response */
        $response = $this->oauthServer->handleAuthorizeRequest(Request::createFromGlobals(), $response, true);
        if (!$response->getParameters()) {
            $code = substr(
                $response->getHttpHeader('Location'),
                strpos($response->getHttpHeader('Location'), 'code=') + 5,
                40
            );
            return $this->response->sendSuccess(['code' => $code]);
        } else {
            return $this->response->sendError(
                ResponseCodes::AUTH_ERROR,
                $response->getStatusCode(),
                $response->getParameter('error_description')
            );
        }
    }
public function authorize()
    {
        $response = new Response();

        /** @var Response $response */
        $response = $this->oauthServer->handleAuthorizeRequest(Request::createFromGlobals(), $response, true);
        if (!$response->getParameters()) {
            $code = substr(
                $response->getHttpHeader('Location'),
                strpos($response->getHttpHeader('Location'), 'code=') + 5,
                40
            );
            return $this->response->sendSuccess(['code' => $code]);
        } else {
            return $this->response->sendError(
                ResponseCodes::AUTH_ERROR,
                $response->getStatusCode(),
                $response->getParameter('error_description')
            );
        }
    }
public function authorize ( ) { $ response = new Response ( ) ; /** @var Response $response */ $ response = $ this -> oauthServer -> handleAuthorizeRequest ( Request :: createFromGlobals ( ) , $ response , true ) ; if ( ! $ response -> getParameters ( ) ) { $ code = substr ( $ response -> getHttpHeader ( 'Location' ) , strpos ( $ response -> getHttpHeader ( 'Location' ) , 'code=' ) + 5 , 40 ) ; return $ this -> response -> sendSuccess ( [ 'code' => $ code ] ) ; } else { return $ this -> response -> sendError ( ResponseCodes :: AUTH_ERROR , $ response -> getStatusCode ( ) , $ response -> getParameter ( 'error_description' ) ) ; } }
Get Authorization code
@author Adeyemi Olaoye <yemi@cottacush.com>
@return mixed
Get Authorization code