{"record":{"id":"9adafdf6ca8934a2","repo":"AlistGo/alist","slug":"oauth2-server-response-error","errorCode":null,"errorMessage":"oauth2: server response error","messagePattern":"oauth2: server response error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/febbox/oauth2.go","lineNumber":67,"sourceCode":"\n\tvar tokenResp struct {\n\t\tCode int    `json:\"code\"`\n\t\tMsg  string `json:\"msg\"`\n\t\tData struct {\n\t\t\tAccessToken  string `json:\"access_token\"`\n\t\t\tExpiresIn    int64  `json:\"expires_in\"`\n\t\t\tTokenType    string `json:\"token_type\"`\n\t\t\tScope        string `json:\"scope\"`\n\t\t\tRefreshToken string `json:\"refresh_token\"`\n\t\t} `json:\"data\"`\n\t}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&tokenResp); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif tokenResp.Code != 1 {\n\t\treturn nil, errors.New(\"oauth2: server response error\")\n\t}\n\n\tc.refreshToken = tokenResp.Data.RefreshToken\n\n\ttoken := &oauth2.Token{\n\t\tAccessToken:  tokenResp.Data.AccessToken,\n\t\tTokenType:    tokenResp.Data.TokenType,\n\t\tRefreshToken: tokenResp.Data.RefreshToken,\n\t\tExpiry:       time.Now().Add(time.Duration(tokenResp.Data.ExpiresIn) * time.Second),\n\t}\n\n\treturn token, nil\n}\n\nfunc (d *FebBox) initializeOAuth2Token(ctx context.Context, oauth2Config *clientcredentials.Config, refreshToken string) {\n\td.oauth2Token = oauth2.ReuseTokenSource(nil, &customTokenSource{\n\t\tconfig:       oauth2Config,\n\t\tctx:          ctx,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/febbox/oauth2.go#L49-L85","documentation":"The FebBox token endpoint answered HTTP 200 but its JSON envelope carries Code != 1, meaning the API rejected the token request (invalid client_id/secret or bad authorization code). The server's msg field is ignored, so only this generic error surfaces.","triggerScenarios":"Thrown at drivers/febbox/oauth2.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","contentChangedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}