golang.org/x/oauth2 v0.38.0: what changed and what breaks when you upgrade
Updated December 2, 2026
On this page
What changed in golang.org/x/oauth2 v0.38.0?
One commit. The git log from v0.37.0 to v0.38.0 holds a single change, "oauth2: prevent NewTicker panic", which fixes golang/go#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.
| 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). |
| v0.37.0 | August 25, 2026 | go directive raised to go 1.26.0 (09a82f6). On Compute Engine, the universe domain is read from universe/universe-domain instead of universe/universe_domain (c624b89). |
| 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). |
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, 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 explains why: Go 1.27.0 was out, so Go 1.25 was no longer supported under the Go 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.modIt 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.0On 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 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.0So 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, December 2, 2026).
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 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). 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 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 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 came in commit bf48bf1 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?
- Check your Go version first. If
go versionor 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. - Run
go get golang.org/x/oauth2@v0.38.0, thengo mod tidy. Commit go.mod and go.sum together, including the go line if it moved. - Search for the deprecated loaders with the git grep above, and switch each call to
CredentialsFromJSONWithTypewith the type you expect. - If you mock the GCE metadata server in tests, change
universe/universe_domaintouniverse/universe-domain. - Run
go build ./...andgo 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 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 shows the same habit for any package.
To see what a public repository is exposed to, run a free scan, or give your coding agent the same answers through the docs. 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 packageHow 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 upgradeHow 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, testedgoogle-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, testedboto3 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.
See how out of date your code is.
Tell your agent what changed since it was trained.
claude mcp add --transport http since https://api.since.dev/mcpCodex, Cursor and any MCP client use https://api.since.dev/mcp.