AlistGo/alist · error

failed to refresh token: %s

Error message

failed to refresh token: %s

What it means

Error "failed to refresh token: %s" thrown in AlistGo/alist.

Source

Thrown at drivers/aliyundrive_share/util.go:31

	// CanaryHeaderKey CanaryHeaderValue for lifting rate limit restrictions
	CanaryHeaderKey   = "X-Canary"
	CanaryHeaderValue = "client=web,app=share,version=v2.3.1"
)

func (d *AliyundriveShare) refreshToken() error {
	url := "https://auth.alipan.com/v2/account/token"
	var resp base.TokenResp
	var e ErrorResp
	_, err := base.RestyClient.R().
		SetBody(base.Json{"refresh_token": d.RefreshToken, "grant_type": "refresh_token"}).
		SetResult(&resp).
		SetError(&e).
		Post(url)
	if err != nil {
		return err
	}
	if e.Code != "" {
		return fmt.Errorf("failed to refresh token: %s", e.Message)
	}
	d.RefreshToken, d.AccessToken = resp.RefreshToken, resp.AccessToken
	op.MustSaveDriverStorage(d)
	return nil
}

// do others that not defined in Driver interface
func (d *AliyundriveShare) getShareToken() error {
	data := base.Json{
		"share_id": d.ShareId,
	}
	if d.SharePwd != "" {
		data["share_pwd"] = d.SharePwd
	}
	var e ErrorResp
	var resp ShareTokenResp
	_, err := base.RestyClient.R().
		SetResult(&resp).SetError(&e).SetBody(data).

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-authenticate the storage: obtain a new refresh_token via the provider's OAuth flow and update the storage configuration.
  2. Verify client_id/client_secret are correct and the refresh token has not been revoked or expired.

When it happens

Trigger: Thrown at drivers/aliyundrive_share/util.go:31 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/f156fd6480a5d6a5. Report an issue: GitHub.