PanJiaChen/vue-admin-template · error

50008

50008

Error message

You have been logged out, you can cancel to stay on this page, or log in again

What it means

Re-login confirmation dialog shown when the API returns business code 50008 (illegal token), 50012 (logged in from another client), or 50014 (token expired); it fires because the auth token was rejected by the server and the user must re-authenticate.

Source

Thrown at src/utils/request.js:59

   * Determine the request status by custom code
   * Here is just an example
   * You can also judge the status by HTTP Status Code
   */
  response => {
    const res = response.data

    // if the custom code is not 20000, it is judged as an error.
    if (res.code !== 20000) {
      Message({
        message: res.message || 'Error',
        type: 'error',
        duration: 5 * 1000
      })

      // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
      if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
        // to re-login
        MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
          confirmButtonText: 'Re-Login',
          cancelButtonText: 'Cancel',
          type: 'warning'
        }).then(() => {
          store.dispatch('user/resetToken').then(() => {
            location.reload()
          })
        })
      }
      return Promise.reject(new Error(res.message || 'Error'))
    } else {
      return res
    }
  },
  error => {
    console.log('err' + error) // for debug
    Message({
      message: error.message,

View on GitHub (pinned to 4c18a3f47b)

Solutions

  1. Log in again via the confirm dialog to obtain a fresh token
  2. If 50012, log out from the other client/session that invalidated this token
  3. Check token expiration handling and consider silent refresh to avoid the dialog
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/utils/request.js:59 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of PanJiaChen/vue-admin-template@4c18a3f47b (2026-09-02). Data as JSON: /api/errors/b31ab59caea252be. Report an issue: GitHub.