PostOAuth2ProviderAppSecret creates a new secret for an OAuth2 application. This is the only time the full secret will be revealed.
(ctx context.Context, appID uuid.UUID)
| 159 | // PostOAuth2ProviderAppSecret creates a new secret for an OAuth2 application. |
| 160 | // This is the only time the full secret will be revealed. |
| 161 | func (c *Client) PostOAuth2ProviderAppSecret(ctx context.Context, appID uuid.UUID) (OAuth2ProviderAppSecretFull, error) { |
| 162 | res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/oauth2-provider/apps/%s/secrets", appID), nil) |
| 163 | if err != nil { |
| 164 | return OAuth2ProviderAppSecretFull{}, err |
| 165 | } |
| 166 | defer res.Body.Close() |
| 167 | if res.StatusCode != http.StatusCreated { |
| 168 | return OAuth2ProviderAppSecretFull{}, ReadBodyAsError(res) |
| 169 | } |
| 170 | var resp OAuth2ProviderAppSecretFull |
| 171 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 172 | } |
| 173 | |
| 174 | // DeleteOAuth2ProviderAppSecret deletes a secret from an OAuth2 application, |
| 175 | // also invalidating any tokens that generated from it. |