passwordcredentials

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Password Credentials Token Source

This package is extracted from https://github.com/golang/oauth2/issues/186. When the passwordcredentials token source is included in the standard library, this package will be removed and the go-uaa package will switch to use the standard library implementation.

License

Copyright 2014 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file:

https://github.com/golang/oauth2/blob/1e0a3fa8ba9a5c9eb35c271780101fdaf1b205d7/LICENSE

Documentation

Overview

Package passwordcredentials implements the OAuth2.0 "password credentials" token flow. See https://tools.ietf.org/html/rfc6749#section-4.3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextClient

func ContextClient(ctx context.Context) *http.Client

Types

type Config

type Config struct {
	// ClientID is the application's ID.
	ClientID string

	// ClientSecret is the application's secret.
	ClientSecret string

	// Resource owner username
	Username string

	// Resource owner password
	Password string

	// Endpoint contains the resource server's token endpoint
	// URLs. These are constants specific to each server and are
	// often available via site-specific packages, such as
	// google.Endpoint or github.Endpoint.
	Endpoint oauth2.Endpoint

	// Scope specifies optional requested permissions.
	Scopes []string

	// EndpointParams specifies additional parameters for requests to the token endpoint.
	EndpointParams url.Values
}

Config describes a Resource Owner Password Credentials OAuth2 flow, with the client application information, resource owner credentials and the server's endpoint URLs.

func (*Config) Client

func (c *Config) Client(ctx context.Context) *http.Client

Client returns an HTTP client using the provided token. The token will auto-refresh as necessary. The underlying HTTP transport will be obtained using the provided context. The returned client and its Transport should not be modified.

func (*Config) TokenSource

func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource

TokenSource returns a TokenSource that returns t until t expires, automatically refreshing it as necessary using the provided context and the client ID and client secret.

Most users will use Config.Client instead.

Jump to

Keyboard shortcuts

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