{"record":{"id":"bf0649c59556dc0a","repo":"AlistGo/alist","slug":"oauth2-cannot-fetch-token","errorCode":null,"errorMessage":"oauth2: cannot fetch token","messagePattern":"oauth2: cannot fetch token","errorType":"http","errorClass":null,"httpStatus":200,"severity":"error","filePath":"drivers/febbox/oauth2.go","lineNumber":47,"sourceCode":"\t}\n\n\tv.Set(\"client_id\", c.config.ClientID)\n\tv.Set(\"client_secret\", c.config.ClientSecret)\n\n\treq, err := http.NewRequest(\"POST\", c.config.TokenURL, strings.NewReader(v.Encode()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := http.DefaultClient.Do(req.WithContext(c.ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.New(\"oauth2: cannot fetch token\")\n\t}\n\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","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/febbox/oauth2.go#L29-L65","documentation":"Error \"oauth2: cannot fetch token\" thrown in AlistGo/alist.","triggerScenarios":"Thrown at drivers/febbox/oauth2.go:47 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":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}