Skip to content

Clarify that oauth2.NewClient does not fetch or validate tokens during client creation #801

Description

@daisyyedda

func NewClient(ctx context.Context, src TokenSource) *http.Client {

While using oauth2.NewClient, I expected that errors related to token retrieval or refresh would surface during client creation. However, the client would be constructed successfully even if TokenSource would later fail.

It appears that token retrieval only happens lazily when the client performs a request via Transport.

It might be helpful to clarify this behavior in the documentation for oauth2.NewClient and/or Config.Client, since users may expect token validation to happen when the client is created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions