Reset is used to reset a valid OAuth token without end user involvement. Applications must save the "token" property in the response, because changes take effect immediately. Note that this operation requires the use of BasicAuth, but where the username is the OAuth application clientID, and the pa
(ctx context.Context, clientID, accessToken string)
| 182 | // |
| 183 | //meta:operation PATCH /applications/{client_id}/token |
| 184 | func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { |
| 185 | u := fmt.Sprintf("applications/%v/token", clientID) |
| 186 | |
| 187 | reqBody := &struct { |
| 188 | AccessToken string `json:"access_token"` |
| 189 | }{AccessToken: accessToken} |
| 190 | |
| 191 | req, err := s.client.NewRequest(ctx, "PATCH", u, reqBody) |
| 192 | if err != nil { |
| 193 | return nil, nil, err |
| 194 | } |
| 195 | req.Header.Set("Accept", mediaTypeOAuthAppPreview) |
| 196 | |
| 197 | var a *Authorization |
| 198 | resp, err := s.client.Do(req, &a) |
| 199 | if err != nil { |
| 200 | return nil, resp, err |
| 201 | } |
| 202 | |
| 203 | return a, resp, nil |
| 204 | } |
| 205 | |
| 206 | // Revoke an authorization for an application. |
| 207 | // |