{"id":"4ebe3e4a5926137d","repo":"docker/cli","slug":"timed-out-waiting-for-device-token","errorCode":null,"errorMessage":"timed out waiting for device token","messagePattern":"timed out waiting for device token","errorType":"exception","errorClass":"ErrTimeout","httpStatus":null,"severity":"error","filePath":"internal/oauth/api/api.go","lineNumber":50,"sourceCode":"\t// ClientID is the client ID for the application to auth with the tenant.\n\tClientID string\n\t// Scopes are the scopes that are requested during the device auth flow.\n\tScopes []string\n}\n\n// TokenResponse represents the response of the /oauth/token route.\ntype TokenResponse struct {\n\tAccessToken      string  `json:\"access_token\"`\n\tIDToken          string  `json:\"id_token\"`\n\tRefreshToken     string  `json:\"refresh_token\"`\n\tScope            string  `json:\"scope\"`\n\tExpiresIn        int     `json:\"expires_in\"`\n\tTokenType        string  `json:\"token_type\"`\n\tError            *string `json:\"error,omitempty\"`\n\tErrorDescription string  `json:\"error_description,omitempty\"`\n}\n\nvar ErrTimeout = errors.New(\"timed out waiting for device token\")\n\n// GetDeviceCode initiates the device-code auth flow with the tenant.\n// The state returned contains the device code that the user must use to\n// authenticate, as well as the URL to visit, etc.\nfunc (a API) GetDeviceCode(ctx context.Context, audience string) (State, error) {\n\tdata := url.Values{\n\t\t\"client_id\": {a.ClientID},\n\t\t\"audience\":  {audience},\n\t\t\"scope\":     {strings.Join(a.Scopes, \" \")},\n\t}\n\n\tdeviceCodeURL := a.TenantURL + \"/oauth/device/code\"\n\tresp, err := postForm(ctx, deviceCodeURL, strings.NewReader(data.Encode()))\n\tif err != nil {\n\t\treturn State{}, err\n\t}\n\tdefer func() {\n\t\t_ = resp.Body.Close()","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/internal/oauth/api/api.go#L32-L68","documentation":"Error \"timed out waiting for device token\" thrown in docker/cli.","triggerScenarios":"Thrown at internal/oauth/api/api.go:50 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}