Skip to content

Instantly share code, notes, and snippets.

@kanzure
Last active October 25, 2020 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanzure/b78f8d7a11af20f62432 to your computer and use it in GitHub Desktop.
Save kanzure/b78f8d7a11af20f62432 to your computer and use it in GitHub Desktop.
gumroad oauth debugger
"""
Simple HTTP server to authenticate with gumroad. This is useful for getting
a permanent auth token even if your application isn't a web app. Just use the
auth token when making requests in the future.
Start the process by visiting:
https://gumroad.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=http://YOURSERVER:7980/callback&scope=edit_products
"""
import json
import requests
from flask import (
Flask,
request,
)
from secrets import (
GUMROAD_APP_ID,
GUMROAD_APP_SECRET,
)
app = Flask(__name__)
@app.route("/callback")
def callback():
code = request.args.get("code")
headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
#headers = {"Content-type": "application/x-www-form-urlencoded"}
headers = {}
response = requests.post("https://gumroad.com/oauth/token", data={"code": code, "client_id": GUMROAD_APP_ID, "client_secret": GUMROAD_APP_SECRET, "redirect_uri": "http://YOURSERVER:7980/callback"}, headers=headers)
with open("wtf.txt", "w") as fh:
fh.write(response.content)
return response.content
if __name__ == "__main__":
app.run(host="0.0.0.0", port=7980, debug=True)
@alvarotrigo
Copy link

Hi there!
I'm a bit curious about this. Where did you get the documentation for calls like https://gumroad.com/oauth/token?
I can't see anything about it on the Gumroad API v2.

@alvarotrigo
Copy link

Trying to find a way to get permissions from a user to get access to their data, i guess I need to authenticate them and get their token.

@kanzure
Copy link
Author

kanzure commented Oct 24, 2020

It's been so long; it was probably once on their documentation, but may not be there anymore.

@alvarotrigo
Copy link

I see. Thanks anyways for the reply! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment