Client Credentials
This commit is contained in:
parent
d272534ac7
commit
2a3ac1d1d5
4 changed files with 107 additions and 0 deletions
12
mastodon.go
12
mastodon.go
|
@ -150,6 +150,18 @@ func (c *Client) Authenticate(ctx context.Context, username, password string) er
|
|||
return c.authenticate(ctx, params)
|
||||
}
|
||||
|
||||
// AuthenticateApp logs in using client credentials.
|
||||
func (c *Client) AuthenticateApp(ctx context.Context) error {
|
||||
params := url.Values{
|
||||
"client_id": {c.Config.ClientID},
|
||||
"client_secret": {c.Config.ClientSecret},
|
||||
"grant_type": {"client_credentials"},
|
||||
"redirect_uri": {"urn:ietf:wg:oauth:2.0:oob"},
|
||||
}
|
||||
|
||||
return c.authenticate(ctx, params)
|
||||
}
|
||||
|
||||
// AuthenticateToken logs in using a grant token returned by Application.AuthURI.
|
||||
//
|
||||
// redirectURI should be the same as Application.RedirectURI.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue