yauth

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 10 Imported by: 5

README

Yahoo OAuth Client for Go

Go Reference

yauth package contains a client implementation of OAuth2 specifically for Yahoo.

Installation

go get github.com/famendola1/yauth

Documentation

Overview

Package yauth provides functionality for OAuth authorization for Yahoo. This package is best suited for CLIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type YAuth

type YAuth struct {
	ClientID     string        `json:"client_id"`
	ClientSecret string        `json:"client_secret"`
	Token        *oauth2.Token `json:"token"`
}

YAuth holds client credentials along with an access token from Yahoo.

func CreateYAuthFromJSON

func CreateYAuthFromJSON(filePath string) (*YAuth, error)

CreateYAuthFromJSON builds a YAuth object from the JSON file located at the provided path. If there is no token in the JSON, one will be retrieved and the file will be updated.

func CreateYAuthFromRawCredentials

func CreateYAuthFromRawCredentials(clientID string, clientSecret string) (*YAuth, error)

CreateYAuthFromRawCredentials builds a YAuth object using the provided client id and client secret. This function will always request a token from Yahoo.

func (*YAuth) Client

func (y *YAuth) Client() *http.Client

Client returns a http.Client to be used for sending requests to Yahoo's API endpoints that require OAuth.

func (*YAuth) WriteToFile

func (y *YAuth) WriteToFile(filePath string) error

WriteToFile writes the YAuth object to the given file in JSON format.

Jump to

Keyboard shortcuts

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