---
title: "golang.org/x/oauth2 v0.38.0 Breaking Changes | Since.dev"
description: "What changed in golang.org/x/oauth2 v0.38.0 and v0.37.0: the Go 1.26 floor, the DeviceAccessToken panic fix and deprecated Google credential loaders. Tested."
canonical_url: https://since.dev/guides/golang-oauth2-v0-38-breaking-changes
last_updated: 2026-12-02
---

# golang.org/x/oauth2 v0.38.0: what changed and what breaks when you upgrade

golang.org/x/oauth2 v0.38.0 (November 6, 2026) has no API break: its one change stops DeviceAccessToken from panicking on a negative or huge polling interval. What breaks upgrades is v0.37.0, which needs Go 1.26 or newer and rewrites your go directive to 1.26.0.

Updated December 2, 2026

## What changed in golang.org/x/oauth2 v0.38.0?

One commit. The [git log from v0.37.0 to v0.38.0](https://go.googlesource.com/oauth2/+log/v0.37.0..v0.38.0) holds a single change, ["oauth2: prevent NewTicker panic"](https://go.googlesource.com/oauth2/+/0f01e8215572819016fac21b005f5f32ba407798), which fixes [golang/go#82658](https://github.com/golang/go/issues/82658). No function, type or constant was added, removed or renamed, and go.mod still says `go 1.26.0`.

There's no CHANGELOG file in the repository, so the commit messages are the release notes. Here is everything since v0.35.0, release by release. The dates are the publish times the Go module proxy reports for each tag.

golang.org/x/oauth2 releases since v0.35.0, from proxy.golang.org and the commits on go.googlesource.com, checked December 2, 2026

| Version | Released          | What changed                                                                                                                                                                                                                                                                                                                              |
| ------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| v0.38.0 | November 6, 2026  | DeviceAccessToken falls back to a 5 second interval when the server sends a negative or overflowing one, instead of panicking ([0f01e82](https://go.googlesource.com/oauth2/+/0f01e8215572819016fac21b005f5f32ba407798)).                                                                                                                 |
| v0.37.0 | August 25, 2026   | go directive raised to go 1.26.0 ([09a82f6](https://go.googlesource.com/oauth2/+/09a82f63d4c718720369edfee3c7d0ff953c0b6f)). On Compute Engine, the universe domain is read from universe/universe-domain instead of universe/universe_domain ([c624b89](https://go.googlesource.com/oauth2/+/c624b89dadc3221560b7345c090bbe69e90808ee)). |
| v0.36.0 | February 11, 2026 | go directive raised to go 1.25.0.                                                                                                                                                                                                                                                                                                         |
| v0.35.0 | January 12, 2026  | CredentialsFromJSONWithType and CredentialsFromJSONWithTypeAndParams added; CredentialsFromJSON and CredentialsFromJSONWithParams deprecated ([89ff2e1](https://go.googlesource.com/oauth2/+/89ff2e1ac388c1a234a687cb2735341cde3f7122)).                                                                                                  |

v0.38.0 isn't a security release either. The Go vulnerability database lists one advisory for this module, GO-2025-3488, fixed in v0.27.0 ([pkg.go.dev/vuln](https://pkg.go.dev/vuln/list), checked December 2, 2026).

## Is golang.org/x/oauth2 v0.38.0 a breaking change?

Not if you're on v0.37.0 already. The only behavior that changed is a panic that became a 5 second wait, and no correct server sends an interval that triggers it.

If you're coming from v0.36.0 or older, you also pick up v0.37.0, and that one can break your build. It requires Go 1.26, so a module or CI job still on Go 1.25 either fails to fetch it or gets its go.mod rewritten. The next section shows both outcomes.

The other change in v0.37.0 only touches Google credentials found on Compute Engine and other Google runtimes (see the universe domain section below). Most code won't notice it.

## Why does go get rewrite my go directive to 1.26.0?

Because v0.37.0 and later declare `go 1.26.0` in their go.mod, and a module can't declare a lower version than its dependencies. [The commit](https://go.googlesource.com/oauth2/+/09a82f63d4c718720369edfee3c7d0ff953c0b6f) explains why: Go 1.27.0 was out, so Go 1.25 was no longer supported under the [Go release policy](https://go.dev/doc/devel/release#policy), which supports each major release until two newer ones exist.

I ran the whole upgrade path on December 2, 2026 with Go 1.27.3, starting from a module at go 1.25.0 and the device flow program further down this page. GOTOOLCHAIN=local keeps Go from switching toolchains:

```
printf 'module example.com/app\n\ngo 1.25.0\n' \
  > go.mod
export GOTOOLCHAIN=local GOFLAGS=-mod=mod
go get golang.org/x/oauth2@v0.36.0
go run . 2>&1 | head -1
go get golang.org/x/oauth2@v0.37.0
go get golang.org/x/oauth2@v0.38.0
go run .
grep '^go ' go.mod
```

It printed this (the panic's stack trace is cut by head):

```
go: added golang.org/x/oauth2 v0.36.0
panic: non-positive interval for NewTicker
go: upgraded go 1.25.0 => 1.26.0
go: upgraded golang.org/x/oauth2 v0.36.0 => v0.37.0
go: upgraded golang.org/x/oauth2 v0.37.0 => v0.38.0
returned: context deadline exceeded
go 1.26.0
```

On a real Go 1.25 toolchain the same `go get` fails. With GOTOOLCHAIN=go1.25.4 it stopped with `go: golang.org/x/oauth2@v0.38.0 requires go >= 1.26.0 (running go 1.25.4; GOTOOLCHAIN=go1.25.4)` and exit code 1. With the default auto mode, Go downloads a newer toolchain and carries on, as the [toolchain docs](https://go.dev/doc/toolchain) describe:

```
$ GOTOOLCHAIN=go1.25.4+auto \
    go get golang.org/x/oauth2@v0.38.0
go: golang.org/x/oauth2@v0.38.0 requires
  go >= 1.26.0; switching to go1.26.11
go: downloading go1.26.11 (darwin/arm64)
go: upgraded go 1.25.0 => 1.26.0
go: added golang.org/x/oauth2 v0.38.0
```

So the same upgrade can pass on a machine that's allowed to switch toolchains and fail in a CI job that runs Go 1.25 with GOTOOLCHAIN=local. The fix is to move the project to Go 1.26 or 1.27 on purpose: update the go line, the CI Go version, and any `golang:1.25` Docker base image in the same pull request. The current releases are go1.27.4 and go1.26.11 ([go.dev/dl](https://go.dev/dl/), December 2, 2026).

On the page, this checker runs in the browser against the retirement calendar. Agents can read the same dates as JSON from <https://api.since.dev/v1/calendar>, free and without a key (filter with `kind=model` or `provider=nodejs`), or check code with `check_code` over MCP.

## What was the DeviceAccessToken panic?

Before v0.38.0, `Config.DeviceAccessToken` passed the server's `interval` straight to `time.NewTicker`, and NewTicker panics on zero or less. A device authorization response with `"interval": -1` crashed the whole program with `panic: non-positive interval for NewTicker`. A huge value such as 9223372037 overflowed when multiplied by a second and did the same.

v0.38.0 treats any interval at or below zero, or too large to fit in a time.Duration, as missing, and uses 5 seconds. That's the default [RFC 8628 section 3.2](https://datatracker.ietf.org/doc/html/rfc8628#section-3.2) gives for a response with no interval. The commit message calls it hardening against a trusted server that acts adversarially, which is the right way to read it: it matters if your CLI talks to an identity provider you don't control.

This is the program from the run above. It points both endpoints at a local test server that always answers with interval -1:

```
package main

import (
	"context"
	"fmt"
	"net/http"
	"net/http/httptest"
	"time"

	"golang.org/x/oauth2"
)

const body = `{"device_code":"d","user_code":"u",
"verification_uri":"https://x","expires_in":5,
"interval":-1}`

func main() {
	h := func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Content-Type",
			"application/json")
		w.Write([]byte(body))
	}
	ts := httptest.NewServer(http.HandlerFunc(h))
	defer ts.Close()
	c := &oauth2.Config{
		ClientID: "id",
		Endpoint: oauth2.Endpoint{
			DeviceAuthURL: ts.URL,
			TokenURL:      ts.URL,
		},
	}
	ctx := context.Background()
	da, err := c.DeviceAuth(ctx)
	if err != nil {
		panic(err)
	}
	ctx, cancel := context.WithTimeout(ctx,
		time.Second)
	defer cancel()
	_, err = c.DeviceAccessToken(ctx, da)
	fmt.Println("returned:", err)
}
```

On v0.36.0 it panics with exit status 2. On v0.38.0 it waits on the 5 second ticker, hits the 1 second context deadline and returns "context deadline exceeded". That's the whole behavior change.

## What changed for Google credentials on Compute Engine?

Since v0.37.0, `google.FindDefaultCredentials` asks the metadata server for `universe/universe-domain` rather than `universe/universe_domain` ([c624b89](https://go.googlesource.com/oauth2/+/c624b89dadc3221560b7345c090bbe69e90808ee)). It only runs on Compute Engine and the other runtimes where `metadata.OnGCE()` is true, and only when something asks the credentials for their universe domain.

If the metadata server answers 404, the code still returns the default `googleapis.com`, so projects in the default universe see no change. Google's newer Go auth library, cloud.google.com/go/auth, reads the same kebab-case path (v0.24.5, internal/internal.go, read December 2, 2026), so v0.37.0 brings the two in line. If you run in a different universe and mock the metadata server in tests, update the path in your mock.

## Is CredentialsFromJSON deprecated, and what replaces it?

Yes. Since v0.35.0, `google.CredentialsFromJSON` and `google.CredentialsFromJSONWithParams` are deprecated in favor of `CredentialsFromJSONWithType` and `CredentialsFromJSONWithTypeAndParams`. The old functions load whatever credential type the JSON says it is. If that JSON comes from a user or another system, it can be an external account config that points token requests at URLs the attacker chose. [Google's guidance](https://docs.cloud.google.com/docs/authentication/client-libraries) is to validate any credential configuration you didn't create.

The new functions take the type you expect, as a `google.CredentialsType` constant (`ServiceAccount`, `AuthorizedUser`, `ExternalAccount`, `ExternalAccountAuthorizedUser`, `ImpersonatedServiceAccount` or `GDCHServiceAccount`), and refuse anything else. I ran this against v0.38.0 with an authorized_user JSON (the package line and imports left out):

```
const userJSON = `{"type":"authorized_user",
"client_id":"x","client_secret":"y",
"refresh_token":"z"}`

func main() {
	ctx := context.Background()
	data := []byte(userJSON)
	scope := "https://www.googleapis.com/auth/cloud-platform"

	_, err := google.CredentialsFromJSONWithType(
		ctx, data, google.ServiceAccount, scope)
	fmt.Println("as ServiceAccount:", err)

	_, err = google.CredentialsFromJSONWithType(
		ctx, data, google.AuthorizedUser, scope)
	fmt.Println("as AuthorizedUser:", err)
}
```

It printed:

```
as ServiceAccount: google: expected credential
  type "service_account", found "authorized_user"
as AuthorizedUser: <nil>
```

Nothing forces the move yet: the old functions still work in v0.38.0, and `go vet` exited 0 with no message on a file that calls `CredentialsFromJSON`. To find every call in a repository, this git grep found the one in my test module:

```
git grep -nE \
  'CredentialsFromJSON(WithParams)?\(' \
  -- '*.go'
```

The type check doesn't validate the URLs inside an ExternalAccount or ImpersonatedServiceAccount file; the [package docs](https://pkg.go.dev/golang.org/x/oauth2/google) say so on those two constants. For those types, still check the config yourself.

## Did v0.38.0 change the policy for new provider endpoints?

No. Some AI answers say v0.38.0 brought an endpoint policy change, but the README line that sends single-endpoint providers to the [endpoints package](https://pkg.go.dev/golang.org/x/oauth2/endpoints) came in [commit bf48bf1](https://go.googlesource.com/oauth2/+/bf48bf16ab8d622ce64ec6ce98d2c98f916b6303) on January 7, 2020. v0.38.0 didn't touch the README, and the provider packages such as `golang.org/x/oauth2/github` are still there.

## How do I upgrade golang.org/x/oauth2 safely?

1. Check your Go version first. If `go version` or your CI says 1.25 or older, move the project to Go 1.26 or 1.27 before anything else, including the Docker base image.
2. Run `go get golang.org/x/oauth2@v0.38.0`, then `go mod tidy`. Commit go.mod and go.sum together, including the go line if it moved.
3. Search for the deprecated loaders with the git grep above, and switch each call to `CredentialsFromJSONWithType` with the type you expect.
4. If you mock the GCE metadata server in tests, change `universe/universe_domain` to `universe/universe-domain`.
5. Run `go build ./...` and `go test ./...` on the same Go version CI uses.

For any other module, the same check works: read the commits between your version and the new tag. The guide to [finding breaking changes between two versions](https://since.dev/guides/breaking-changes-between-versions.md) has the commands for Go, npm and PyPI.

## Where Since.dev fits

golang.org/x/oauth2 ships no changelog file, so a release like v0.37.0 can raise your Go floor with no release note to warn you. Since.dev tracks releases and runtimes like these with their sources, and the guide on [checking dependencies for breaking changes before upgrading](https://since.dev/guides/dependency-breaking-changes.md) shows the same habit for any package.

To see what a public repository is exposed to, run a free [scan](https://since.dev/scan.md), or give your coding agent the same answers through the [docs](https://since.dev/docs.md). When a change reaches a repository you connect, Since.dev reports where your code is affected and can open a pull request with the fix for you to review. It doesn't open routine version bumps. Nothing merges or deploys on its own.

## Questions

### Does golang.org/x/oauth2 v0.38.0 have breaking changes?

No API changes. Its one commit makes DeviceAccessToken use a 5 second interval instead of panicking when the server sends a negative or huge one. If you upgrade from v0.36.0 or older, you also get v0.37.0, which requires Go 1.26.

### What Go version does golang.org/x/oauth2 v0.38.0 need?

Go 1.26.0 or newer, set by the go directive in its go.mod since v0.37.0 (August 25, 2026). With GOTOOLCHAIN=local on Go 1.25, go get fails and says the module requires go 1.26.0 or newer; with the default auto mode, Go downloads a newer toolchain and raises your go line to 1.26.0.

### Why did go get change the go line in my go.mod?

A module's go line can't be lower than any dependency's, so adding golang.org/x/oauth2 v0.37.0 or later raises it to 1.26.0. Go prints a line saying it upgraded go from 1.25.0 to 1.26.0 when it does. Commit that change on purpose, with the matching CI and Docker image updates.

### How do I fix "panic: non-positive interval for NewTicker" in the OAuth device flow?

Upgrade golang.org/x/oauth2 to v0.38.0. Older versions pass the server's interval straight to time.NewTicker, which panics on zero or less; v0.38.0 falls back to the 5 second default from RFC 8628. The panic only happens when the authorization server sends an invalid interval.

### What should I use instead of google.CredentialsFromJSON?

Use google.CredentialsFromJSONWithType, available since v0.35.0, and pass the type you expect, such as google.ServiceAccount. When the JSON is a different type, it returns an error that starts with google: expected credential type, then names the type it wanted and the type it found. The old function still works in v0.38.0 but is deprecated.

## Related guides

### How-to

- [How to find the breaking changes between two versions of a package](https://since.dev/guides/breaking-changes-between-versions.md)How to find breaking changes between two versions of a package: list the releases in between, read each changelog, diff the code. Commands for npm, PyPI, Go.
- [How to check your dependencies for breaking changes before you upgrade](https://since.dev/guides/dependency-breaking-changes.md)How to check dependencies for breaking changes before upgrading: the commands, a real failing upgrade, CI that fails on deprecations, and where notices appear.
- [google-auth 2.56.2 breaking change: the service account email check, tested](https://since.dev/guides/google-auth-2-56-2-breaking-changes.md)google-auth 2.56.2 only runs the Regional Access Boundary lookup for .gserviceaccount.com emails, and 2.63.0 turns it off by default. Tested on three versions.
- [boto3 1.44.0 breaking changes: the new retry default, tested](https://since.dev/guides/boto3-1-44-breaking-changes.md)boto3 1.44.0 makes standard retries the default: 3 attempts instead of 5, much shorter waits, and bearer tokens need HTTPS. Tested on both versions.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
