{"id":"18af662c1a1a4a0c","repo":"docker/cli","slug":"failed-to-get-tokens-w","errorCode":null,"errorMessage":"failed to get tokens: %w","messagePattern":"failed to get tokens: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/api/api.go","lineNumber":172,"sourceCode":"\t}\n\tt.Reset(d)\n}\n\n// getDeviceToken calls the token endpoint of Auth0 and returns the response.\nfunc (a API) getDeviceToken(ctx context.Context, state State) (TokenResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, 1*time.Minute)\n\tdefer cancel()\n\n\tdata := url.Values{\n\t\t\"client_id\":   {a.ClientID},\n\t\t\"grant_type\":  {\"urn:ietf:params:oauth:grant-type:device_code\"},\n\t\t\"device_code\": {state.DeviceCode},\n\t}\n\toauthTokenURL := a.TenantURL + \"/oauth/token\"\n\n\tresp, err := postForm(ctx, oauthTokenURL, strings.NewReader(data.Encode()))\n\tif err != nil {\n\t\treturn TokenResponse{}, fmt.Errorf(\"failed to get tokens: %w\", err)\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\t// this endpoint returns a 403 with an `authorization_pending` error until the\n\t// user has authenticated, so we don't check the status code here and instead\n\t// decode the response and check for the error.\n\tvar res TokenResponse\n\terr = json.NewDecoder(resp.Body).Decode(&res)\n\tif err != nil {\n\t\treturn res, fmt.Errorf(\"failed to decode response: %w\", err)\n\t}\n\n\treturn res, nil\n}\n\n// RevokeToken revokes a refresh token with the tenant so that it can no longer","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/api/api.go#L154-L190","documentation":"Error \"failed to get tokens: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/api/api.go:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}