ExternalAuthByID returns the external auth for the given provider by ID.
(ctx context.Context, provider string)
| 161 | |
| 162 | // ExternalAuthByID returns the external auth for the given provider by ID. |
| 163 | func (c *Client) ExternalAuthByID(ctx context.Context, provider string) (ExternalAuth, error) { |
| 164 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/external-auth/%s", provider), nil) |
| 165 | if err != nil { |
| 166 | return ExternalAuth{}, err |
| 167 | } |
| 168 | defer res.Body.Close() |
| 169 | if res.StatusCode != http.StatusOK { |
| 170 | return ExternalAuth{}, ReadBodyAsError(res) |
| 171 | } |
| 172 | var extAuth ExternalAuth |
| 173 | return extAuth, json.NewDecoder(res.Body).Decode(&extAuth) |
| 174 | } |
| 175 | |
| 176 | // UnlinkExternalAuthByID deletes the external auth for the given provider by ID |
| 177 | // for the user. This does not revoke the token from the IDP. |