diff options
author | r <r@freesoftwareextremist.com> | 2023-10-02 06:44:26 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2023-10-02 06:44:26 +0000 |
commit | b83a00aa2cdabfc20c162379c885caac0110e167 (patch) | |
tree | e212d216b794374624bef4d241038a763066a250 /mastodon | |
parent | df031d5eddc3dc581e228bfcd9a327b9f169cdd5 (diff) | |
download | bloat-b83a00aa2cdabfc20c162379c885caac0110e167.tar.gz bloat-b83a00aa2cdabfc20c162379c885caac0110e167.zip |
Revoke oauth token on signout
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/mastodon.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mastodon/mastodon.go b/mastodon/mastodon.go index a80269d..194ca30 100644 --- a/mastodon/mastodon.go +++ b/mastodon/mastodon.go @@ -138,6 +138,16 @@ func (c *Client) AuthenticateToken(ctx context.Context, authCode, redirectURI st return c.authenticate(ctx, params) } +func (c *Client) RevokeToken(ctx context.Context) error { + params := url.Values{ + "client_id": {c.config.ClientID}, + "client_secret": {c.config.ClientSecret}, + "token": {c.GetAccessToken(ctx)}, + } + + return c.doAPI(ctx, http.MethodPost, "/oauth/revoke", params, nil, nil) +} + func (c *Client) authenticate(ctx context.Context, params url.Values) error { u, err := url.Parse(c.config.Server) if err != nil { |