yandexauth

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 7 Imported by: 1

README

Реализация входа в аккаунт на Яндексе.

https://yandex.ru/dev/id/doc/ru/codes/screen-code-oauth#simple-input-client__get-codes

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilCodes        = errors.New(_errPrefix + "nil codes")
	ErrInvalidGrant    = errors.New(_errPrefix + "incorrect or expired confirmation code")
	ErrBrokenTokensErr = errors.New(_errPrefix + "statusCode != 200, but tokensError is empty (API changed?)")
	ErrBrokenClient    = errors.New(_errPrefix + "broken client_id or client_secret (OAuth App changed?)")
)
View Source
var (
	ErrNilOnUrlCode = errors.New(_errPrefix + "nil onUrlCode")
)

Functions

func New

func New(
	ctx context.Context,
	clientID,
	clientSecret,
	login,
	hostname string,
	onUrlCode func(url string, code string)) (*oauth2.Token, error)

ClientID - ID приложения.

ClientSecret - Secret приложения.

Login - логин / почта на Яндексе.

Hostname - имя устройства (будет отображаться в списке авторизованных устройств).

onUrlCode - перейти по URL Яндекса, войти в аккаунт, ввести код. Спустя несколько секунд будут получены токены.

func Refresh

func Refresh(ctx context.Context, refreshToken, clientID, clientSecret string) (*oauth2.Token, error)

Обновить токены.

https://yandex.ru/dev/id/doc/ru/tokens/refresh-client

Types

This section is empty.

Jump to

Keyboard shortcuts

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