/** * 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); }
/** * Issue an auth code. * * @param string $ownerType the auth code owner type * @param string $ownerId the auth code owner id * @param array $params additional parameters to merge * @return string the auth code redirect url * @static */ public static function issueAuthCode($ownerType, $ownerId, $params = array()) { return \LucaDegasperi\OAuth2Server\Authorizer::issueAuthCode($ownerType, $ownerId, $params); }