token

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(client *http.Client) func(*opt)

Types

type OptFunc

type OptFunc func(*opt)

type TokenInfo

type TokenInfo struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int64  `json:"expires_in"` // トークンが有効な CreatedAt からの秒数
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	CreatedAt    int64  `json:"created_at"` // トークンが作成された Unix 秒
	CompanyID    int    `json:"company_id"`
}

func GetAccessToken

func GetAccessToken(clientID string, clientSecret string, redirectURI string, authorizeCode string, opts ...OptFunc) (*TokenInfo, error)

GetAccessToken は認可コードを使用して freee の API アクセスに必要なトークン情報を取得します。

func RefreshAccessToken

func RefreshAccessToken(clientID string, clientSecret string, refreshToken string, opts ...OptFunc) (*TokenInfo, error)

RefreshAccessToken はリフレッシュトークンを使用して freee の API アクセスに必要なトークン情報を取得します。

func (TokenInfo) IsExpired added in v0.0.5

func (token TokenInfo) IsExpired() bool

IsExpired は現在時刻においてトークンの有効期限が切れているかを取得します。

func (TokenInfo) IsExpiredIn added in v0.0.5

func (token TokenInfo) IsExpiredIn(t time.Time) bool

IsExpired は指定した時刻においてトークンの有効期限が切れているかを取得します。

Jump to

Keyboard shortcuts

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