Skip to main content

discord_port is a simple way to make auth with the Discord API!

Project description

Discord Port

Way to make an easy Oauth2 with discord API

How it's work?

pip install discord-port

Create AuthClient

import discord_port

passport = discord_port.AuthClient(c,client_id=None,client_secret=None,redirect_uri=None)

Exchange for the code

import discord_port

passport = discord_port.AuthClient(c,client_id=None,client_secret=None,redirect_uri=None)

#This using a framework called FLASK `pip install flask`
@app.route('/discord/api/oauth2')
def oauth():
    paylaod_recived = passport.get_code(request.args["code"])
    """
    The payload will return as 
    {
        "access_token": "6qrZcUqja7812RVdnEKjpzOL4CvHBFG",
        "token_type": "Bearer",
        "expires_in": 604800,
        "refresh_token": "D43f5y0ahjqew82jZ4NViEr2YafMKhue",
        "scope": "identify"
    }
    """
    return paylaod_recived["access_token"]

Get UserLogged

import discord_port

discord_port.UserAPI(code="access_token").get_user

Made by 🇮🇶 Iraqi hands : airbu#1745 in 7:40AM GMT+3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord_port-1.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page