code: function(params, stateData) {
            // Handle an error response from the OAuth server
            if (params.error) {
              authLogger.log("RedirectLoginService.finish(), error", params.error, params.error_description, params.error_uri);
              return $q.reject({
                error: params.error,
                error_description: params.error_description,
                error_uri: params.error_uri
              });
            }
  
            // Handle an access_token fragment response
            if (params.access_token) {
              return $q.when({
                token: params.access_token,
                ttl: params.expires_in,
                then: stateData.then,
                verified: stateData.verified
              });
            }
  
            // No token and no error is invalid
            return $q.reject({
              error: "invalid_request",
              error_description: "No API token returned"
            });
          }
docs: handleParams handles error or access_token responses