❤️ Become a Sponsor of my Open Source Work
⌨️ Learn how to script for alt:V
💡 Need a Roleplay Script? Try Athena!
⭐ This repository if you found it useful!
This repository simplifies the entire process of Discord Authentication for alt:V or any GTA:V Framework if you write your own module.
It requires no extra configuration and simply works out of the box. Plug it into your server and users will be able to Authenticate through Discord immediately.
This is the easiest Discord oAuth2 Service. Period.
# Install alt:V Installer
npm install -g altv-pkg
# Install with alt:V Installer
altv-pkg i stuyk/altv-ares
I cannot stress this enough. Ensure you have NodeJS 13+ or you will have problems.
- NodeJS 13+
- An Existing or New Gamemode
- General Scripting Knowledge
Clone this repository into your resources
folder or use the quick install instructions.
Add this resource to your server.cfg
.
npm install elliptic sjcl axios dotenv
When the player connect to your server a event will automatically be emitted to open the WebView.
You will recieve the player through Discord:Opened
when they have opened the view.
alt.on(`Discord:Opened`, (player) => {
// Do something with the Player if you want.
// Setting a player position is recommended here.
});
You will recieve a player login through this event on server-side with their corresponding discord info.
This is their Authentication data. This is what you use to store data in the database and lookup info from your database.
alt.on('Discord:Login', (player, discordInfo) => {
// discordInfo contains -> // id, username, avatar, discriminator, public_flags, flags, locale, mfa_enabled
console.log(discordInfo.id); // This is their unique discord id.
});
The player's WebView will automatically be closed when the discord login is successful.
The Discord:Login event is your success event.
January 20, 2020
+ Portless is supported and enforced now.
+ Completely removed express server.
+ Skip IP Lookup for Portless (Fastest)
January 12, 2020
+ Added New Portless Discord Authentication
+ Added New Portless Parameters
+ Added 'dotenv' as a dependency
January 3, 2020
+ Updated Ares Endpoint (Deprecated Old Server Provider)
+ Moved to auto-updating URL under https://ares.stuyk.com/