Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method to delete an authorized application? #303

Open
csandanov opened this issue Feb 21, 2020 · 3 comments
Open

Method to delete an authorized application? #303

csandanov opened this issue Feb 21, 2020 · 3 comments
Assignees

Comments

@csandanov
Copy link

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.

@Verolop
Copy link
Contributor

Verolop commented Feb 21, 2020

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 :)

@csandanov
Copy link
Author

Any updates?

@andrewsomething
Copy link
Member

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)
}

@InManuBytes InManuBytes self-assigned this Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants