oauth2local

package module
v0.0.0-...-d8aedfd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

README

Go Reference Code Coverage License

Go Reference Code Coverage License

Gets an OAuth 2.0 token for a command-line program through the user's browser. GetToken starts a server on localhost:8080, opens /auth, which redirects to the provider's consent page, and exchanges the code the provider sends back to /callback (register http://localhost:8080/callback as a redirect URL). With a service name, the token is cached under the system temp directory, one file per set of scopes, and refreshed when it expires. GetClient returns an *http.Client that uses that token.

Additional Information

Contributing

Contributions are welcome — please open an issue or a pull request on GitHub.

License

This project is licensed under the Apache 2.0 License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(ctx context.Context, cfg *oauth2.Config, service string) (*http.Client, error)

func GetToken

func GetToken(ctx context.Context, cfg *oauth2.Config, service string) (*oauth2.Token, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址