Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const (
HouseholdsPath rawPath
)
View Source
const (
HouseholdsRatelimiter ratelimiter
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Token ¶
type Token struct { AccessToken string `bson:"access_token" json:"access_token" sql:"access_token"` ExpiresIn int `bson:"expires_in" json:"expires_in" sql:"expires_in"` TokenType string `bson:"token_type" json:"token_type" sql:"token_type"` }
Token is an OAuth bearer token authorized using a base64-encoded user id and password.
func NewBearerToken ¶
NewBearerToken will generate a bearer token with base64-encrypted username and password.
Example ¶
package main import ( "log" "os" "github.com/alpine-hodler/web/pkg/morningstar" ) func main() { url := "https://www.us-api.morningstar.com/token/oauth" username := os.Getenv("MORNINGSTAR_USERNAME") password := os.Getenv("MORNINGSTAR_PASSWORD") token, err := morningstar.NewBearerToken(url, username, password) if err != nil { log.Fatalf("error posting client credentials: %v", err) } // Do something with our token os.Setenv("MORNINGSTAR_BEARER_TOKEN", token.AccessToken) }
Output:
Click to show internal directories.
Click to hide internal directories.