Giter Club home page Giter Club logo

Comments (1)

dosubot avatar dosubot commented on June 23, 2024 2

To resolve the "User suspended" error and regain access to your Langflow Store account and API, you should follow these steps:

  1. Check Error Count and Logout: The system automatically logs out the user if the authentication error count exceeds 3. Ensure that you are not repeatedly failing to authenticate, as this will trigger the logout mechanism.

  2. Renew Access Token: The code includes a function tryToRenewAccessToken that attempts to renew the access token. This function is called when a 401 or 403 error is encountered. Ensure that your access token is being renewed correctly.

  3. Login Again: If the access token renewal fails, the system logs out the user. You will need to log in again to reset the authentication state.

Here is the relevant part of the code that handles these steps:

function checkErrorCount() {
  authenticationErrorCount = authenticationErrorCount + 1;

  if (authenticationErrorCount > 3) {
    authenticationErrorCount = 0;
    logout();
    return false;
  }

  return true;
}

async function tryToRenewAccessToken(error: AxiosError) {
  try {
    if (window.location.pathname.includes("/login")) return;
    const res = await renewAccessToken();
    if (res?.data?.access_token && res?.data?.refresh_token) {
      login(res?.data?.access_token);
    }
    if (error?.config?.headers) {
      delete error.config.headers["Authorization"];
      error.config.headers["Authorization"] = `Bearer ${cookies.get(
        "access_token_lf"
      )}`;
      const response = await axios.request(error.config);
      return response;
    }
  } catch (error) {
    clearBuildVerticesState(error);
    logout();
    return Promise.reject("Authentication error");
  }
}

To summarize:

  • Ensure you are not repeatedly failing to authenticate.
  • Allow the system to renew your access token.
  • If the token renewal fails, log in again to reset your authentication state [1].

To continue talking to Dosu, mention @dosu.

from langflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.