{"record":{"id":"2fa256bcdb2e9778","repo":"AlistGo/alist","slug":"clientid-and-clientsecret-are-required-in-client-c","errorCode":null,"errorMessage":"clientID and clientSecret are required in client_credentials mode","messagePattern":"clientID and clientSecret are required in client_credentials mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"drivers/123_open/client.go","lineNumber":38,"sourceCode":"\n// newSDKClient builds the SDK client for the configured authentication mode.\nfunc (d *Open123) newSDKClient() (*pan123.Client, error) {\n\topts := []pan123.Option{\n\t\tpan123.WithHTTPClient(&http.Client{Timeout: 60 * time.Second}),\n\t\tpan123.WithUserAgent(\"AList/\" + conf.Version),\n\t}\n\tswitch d.AuthMode {\n\tcase AuthToken:\n\t\tif d.AccessToken == \"\" {\n\t\t\treturn nil, errors.New(\"access_token is required in token mode\")\n\t\t}\n\t\tc := pan123.NewWithToken(d.AccessToken, opts...)\n\t\t// expiry is unknown for an externally issued token; refresh on demand\n\t\tc.SetToken(d.AccessToken, d.tokenExpiry())\n\t\treturn c, nil\n\tcase AuthClientCredentials, \"\":\n\t\tif d.ClientID == \"\" || d.ClientSecret == \"\" {\n\t\t\treturn nil, errors.New(\"clientID and clientSecret are required in client_credentials mode\")\n\t\t}\n\t\treturn pan123.New(d.ClientID, d.ClientSecret, opts...), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown auth_mode: %s\", d.AuthMode)\n\t}\n}\n\n// tokenExpiry reports the stored expiry of an externally issued access token.\n// A zero time tells the SDK never to refresh on its own; renewal is driven by\n// ensureToken so the rotated refresh_token can be persisted.\nfunc (d *Open123) tokenExpiry() time.Time {\n\tif d.accessTokenExpiredAt.IsZero() {\n\t\treturn time.Time{}\n\t}\n\treturn d.accessTokenExpiredAt\n}\n\n// ensureToken renews an externally issued access token when it is about to","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/123_open/client.go#L20-L56","documentation":"Returned by Terabox.Init when /api/check/login completes with errno != 0 and != 9000. In practice this means the configured cookie is invalid, expired, or lacks the required session fields, so the account cannot be authenticated.","triggerScenarios":"Initializing or refreshing the Terabox storage with a Cookie value that is malformed, from a logged-out session, missing key cookies, or copied partially; changing the account password on the Terabox side invalidating the session.","commonSituations":"Cookie string copied without all entries or with stray characters/quotes; long-running mount whose cookie expired since last use; browser cookie rotation; account logged in elsewhere causing session invalidation.","solutions":["Re-log into Terabox in a browser and copy the complete, fresh cookie string into the driver configuration, then reload the storage.","Confirm there is no leading/trailing whitespace or quote characters around the cookie value.","If it still fails, clear cookies on the account, log in again, and re-add; check that the account itself is not restricted or banned."],"exampleFix":"# before (config)\ncookie: \"lang=en; \" # session cookies missing -> errno != 0\n\n# after (config): full fresh cookie set from a live browser session\ncookie: \"ndus=...; jsToken=...; lang=en; ...\"","handlingStrategy":"try-catch","validationCode":"// cheap pre-check: cookie has plausible required entries\nif !strings.Contains(d.Cookie, \"ndus=\") {\n\t// cookie likely incomplete; re-copy from browser before Init\n}","typeGuard":"func looksLikeTeraboxCookie(c string) bool {\n\tc = strings.TrimSpace(c)\n\treturn c != \"\" && strings.Contains(c, \"=\") && !strings.HasPrefix(c, \"\\\"\")\n}","tryCatchPattern":"if err := d.Init(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"failed to check login status\") {\n\t\t// prompt user to refresh the cookie in storage config, then reload storage\n\t}\n}","preventionTips":["Copy the complete cookie string from a live logged-in browser session.","Trim whitespace and quotes when pasting the cookie into config.","Re-authenticate after any password change or forced logout on the account."],"tags":["terabox","auth","cookie","driver-init"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}