Route::get('authorize', array('before' => 'check-authorization-params|auth', function() { // get the data from the check-authorization-params filter $params = Session::get('authorize-params'); // get the user id $params['user_id'] = Auth::user()->id; // check if user already has authorized client for scopes $scopesAuthorized = Auth::user()->scopesAuthorizedByClientId($params['client_id']); $scopesNotAuthorized = array_diff(array_fetch($params['scopes'], 'scope'), $scopesAuthorized); if(sizeof($scopesNotAuthorized) == 0) { // all requested scopes have already been approved by the user -> skip the authorization dialog $code = AuthorizationServer::newAuthorizeRequest('user', $params['user_id'], $params); Session::forget('authorize-params'); return Redirect::to(AuthorizationServer::makeRedirectWithCode($code, $params)); } // display the authorization form return View::make('oauth.authorize', array('params' => $params)); }));