Last active
October 25, 2020 11:56
-
-
Save kanzure/b78f8d7a11af20f62432 to your computer and use it in GitHub Desktop.
gumroad oauth debugger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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) |
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.
It's been so long; it was probably once on their documentation, but may not be there anymore.
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
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.