Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.
/ README_Example Public archive

A simple, and easy to use, PHP implementation of a Discord OAuth2 login flow. Implements a "Login with Discord" button on your site. Use this repo to build your very own Discord Dashboard! 🚀

Notifications You must be signed in to change notification settings

f-o/README_Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

This is/was my development repo for creating a proper README.md file for the project Markisdev/Discord-Oauth.
I have since used this "template" for other projects. Feel free to take inspiration from here!

The animated image is an APNG file, and has been created like this.


Discord OAuth
Discord OAuth

An Open Source demonstration of a PHP Discord OAuth login flow, with multiple examples to build on top of.


chat on Discord

Key Features • How To Use • Contributing • Support • License

Discord OAuth Demo

Key Features

  • Get user data
    • ID, Username, Avatar, Discrim etc.
  • Get user connections
    • Battlenet, Facebook, Github, Spotify, Twitter, Youtube etc.
  • Get user guilds
    • IDs, Icons, User permissions, Enabled guild features etc.
  • Get guild user
    • Nickname, Roles, Join date etc.
  • Get guild object (requires bot)
  • Give guild role (requires bot)
  • ...and more!

How To Use

Prerequisites:

  • Git for cloning the repo
  • XAMPP (or another web server) for running the PHP application
  • Discord Application with OAuth2 CLIENT ID and CLIENT SECRET

Start by cloning this repository to your computer.

$ git clone https://github.com/MarkisDev/discordoauth

Now open up XAMPP Control Panel, and click on the Config button in the Apache module.

You want to search for "DocumentRoot", and change the values from C:/xampp/htdocs into the path of your discordoauth folder.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:\WEB\discordoauth\demos"
<Directory "C:\WEB\discordoauth\demos">

Note You may want to point the root directly to one of the included examples for ease of access (C:\WEB\discordoauth\demos\simple-demo).

Next you need to open the config.php file for the demo you wish to run.

All demos included in this repo come with their own individual config-file. If you wish to try out multiple demos, you will need to edit the values in their respective config.php file.

Fill out the config file as shown in the examples with values from Discord Developers Dashboard.

<?php
# CLIENT ID
$client_id = "623204361394291813";

# CLIENT SECRET
$secret_id = "roOWew9eNHEQS54SQc6v1pl8YBBiX5O0";

# SCOPES SEPARATED BY + SIGN
$scopes = "identify";

# REDIRECT URL
$redirect_url = "http://localhost/simple-demo/includes/login.php";

When you have done this, you must copy the full $redirect_url link, and paste it on the Discord Developers Dashboard under your Applications OAuth2 Redirects. OAuth Redirect

Note You can add multiple redirects to the same application, so feel free to also add the redirects for the other demos:
http://localhost/admin-dashboard/includes/login.php
http://localhost/bot-dashboard/includes/login.php

When you have done all the above steps, you should be able to visit localhost/simple-demo in your browser, and see the OAuth demo in action!

If you encounter any issues along the way, give us a visit in our Discord Server, and we'll be sure to lead you back on the right track!


Contributing

Contributions to the project are always welcome!

If you found a bug, please open an issue and let us know.

If you have a request for a feature you can also open an issue and we will take a look at it.

We accept pull requests for any fixes and/or new features.

If you want to contribute a new demo, please remember to copy any new Discord related functions to the discord.php file in the root of the repo.


Support

Support the Author here:
Buy Me A Coffee

Support the Maintainer here:
Buy Me A Coffee


License

MIT License

Copyright (c) 2022 MarkisDev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@f-o  ·  soon.to

About

A simple, and easy to use, PHP implementation of a Discord OAuth2 login flow. Implements a "Login with Discord" button on your site. Use this repo to build your very own Discord Dashboard! 🚀

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published