Movatterモバイル変換


[0]ホーム

URL:


clientcredentials

package
v0.34.0Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License:BSD-3-ClauseImports:7Imported by:2,350

Details

Repository

cs.opensource.google/go/x/oauth2

Links

Documentation

Overview

Package clientcredentials implements the OAuth2.0 "client credentials" token flow,also known as "two-legged OAuth 2.0".

This should be used when the client is acting on its own behalf or when the clientis the resource owner. It may also be used when requesting access to protectedresources based on an authorization previously arranged with the authorizationserver.

Seehttps://tools.ietf.org/html/rfc6749#section-4.4

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeConfig

type Config struct {// ClientID is the application's ID.ClientIDstring// ClientSecret is the application's secret.ClientSecretstring// TokenURL is the resource server's token endpoint// URL. This is a constant specific to each server.TokenURLstring// Scopes specifies optional requested permissions.Scopes []string// EndpointParams specifies additional parameters for requests to the token endpoint.EndpointParamsurl.Values// AuthStyle optionally specifies how the endpoint wants the// client ID & client secret sent. The zero value means to// auto-detect.AuthStyleoauth2.AuthStyle// contains filtered or unexported fields}

Config describes a 2-legged OAuth2 flow, with both theclient application information and the server's endpoint URLs.

func (*Config)Client

func (c *Config) Client(ctxcontext.Context) *http.Client

Client returns an HTTP client using the provided token.The token will auto-refresh as necessary.

The provided context optionally controls which HTTP clientis returned. See theoauth2.HTTPClient variable.

The returnedhttp.Client and its Transport should not be modified.

func (*Config)Token

func (c *Config) Token(ctxcontext.Context) (*oauth2.Token,error)

Token uses client credentials to retrieve a token.

The provided context optionally controls which HTTP client is used. See theoauth2.HTTPClient variable.

func (*Config)TokenSource

func (c *Config) TokenSource(ctxcontext.Context)oauth2.TokenSource

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

Most users will useConfig.Client instead.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp