Method to delete an authorized application?
I have an app integration with DigitalOcean and when a user deletes the integration on my app I want to delete it on DigitalOcean. As I understand this could be achieved via https://developers.digitalocean.com/documentation/oauth/#revoke-token-flow, right? Currently as I understand there's no such method in the sdk.
Hi @csandanov ! Thanks for your report, happy to take a look to see if there's a workaround for this or if it's possible to make it happen soon :)
Any updates?
Hey @csandanov,
The SDK does not currently support revoking Oauth tokens. It's something we may add in the future, but there are still some questions around how we want to approach it. In the meantime, here's a quick Go example for revoking a DigitalOcean Oauth token for anyone landing here:
package main
import (
"log"
"net/url"
"golang.org/x/oauth2"
)
const (
revokeUrl = "https://cloud.digitalocean.com/v1/oauth/revoke"
)
func main() {
token := "theoauthtokenhere"
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
client := oauth2.NewClient(oauth2.NoContext, tokenSource)
params := url.Values{}
params.Set("token", token)
resp, err := client.PostForm(revokeUrl, params)
if err != nil {
log.Fatalf("Error revoking token: %s", err.Error())
}
log.Printf("Response status: %s", resp.Status)
}