Categorygithub.com/int128/oauth2dev
modulepackage
1.0.1
Repository: https://github.com/int128/oauth2dev.git
Documentation: pkg.go.dev

# README

oauth2dev go

This package is an implementation of OAuth 2.0 Device Authorization Grant, described in RFC 8628. It is compatible with golang.org/x/oauth2 package.

# Packages

An example for Google OAuth 2.0 for TV and Limited-Input Device Applications, described in https://developers.google.com/identity/protocols/oauth2/limited-input-device To run this example, go run ./example -client-id YOUR_ID -client-secret YOUR_SECRET You need to create an OAuth client before running this example.

# Functions

GetToken sends an authorization request and then polls the token response.
PollToken tries a token request and waits until it receives a token response.
RetrieveCode sends an authorization request to the authorization endpoint.
RetrieveToken sends a token request to the endpoint.

# Constants

Error codes of token response, described in https://www.rfc-editor.org/rfc/rfc8628#section-3.5.
Error codes of token response, described in https://www.rfc-editor.org/rfc/rfc8628#section-3.5.
Error codes of token response, described in https://www.rfc-editor.org/rfc/rfc8628#section-3.5.
Error codes of token response, described in https://www.rfc-editor.org/rfc/rfc8628#section-3.5.

# Structs

AuthorizationErrorResponse represents the error response, described in https://www.rfc-editor.org/rfc/rfc6749#section-5.2.
AuthorizationResponse represents Device Authorization Response, described in https://www.rfc-editor.org/rfc/rfc8628#section-3.2.
TokenErrorResponse represents an error response, described in https://www.rfc-editor.org/rfc/rfc6749#section-5.2 and https://www.rfc-editor.org/rfc/rfc8628#section-3.5.

# Type aliases

HandleAuthorizationResponseFunc is a function to handle an authorization response.