/** * Perform resource owner authorization wheter approve or deny * @param Authorizer $authorizer * @param Guard $auth * @param Request $request * @return Redirect response */ public function postAuthorization(Authorizer $authorizer, Guard $auth, Request $request) { $params = $authorizer->getAuthCodeRequestParams(); $params['user_id'] = $auth->user()->id; $redirectUri = ''; // if the user has allowed the client to access its data, redirect back to the client with an auth code if ($request->input('approve') !== null) { $redirectUri = $authorizer->issueAuthCode('user', $params['user_id'], $params); } // if the user has denied the client to access its data, redirect back to the client with an error message if ($request->input('deny') !== null) { $redirectUri = $authorizer->authCodeRequestDeniedRedirectUri(); } return redirect($redirectUri); }
/** * Generate a redirect uri when the auth code request is denied by the user. * * @return string a correctly formed url to redirect back to * @static */ public static function authCodeRequestDeniedRedirectUri() { return \LucaDegasperi\OAuth2Server\Authorizer::authCodeRequestDeniedRedirectUri(); }