Skip to content

alt:V discord login resource with cross resource compatibility

Notifications You must be signed in to change notification settings

altv-crc/crc-discord-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[CRC][TS] alt:V Discord Login

Supported by CRC

A simple discord authentication plugin.

Requires

Highly recommended to get the extension, for better event handling.

Installation

  1. Install NPM packages
npm i @stuyk/cross-resource-cache
  1. Install crc-db resource

  2. Create a folder in your src folder called crc-discord-login.

  3. Add the TypeScript files from this resource, to that folder.

  4. Modify server.toml and ensure it loads whatever you named the folder.

In the case of the example above it should be crc-discord-login.

resources = [ 
    'crc-db',
    'crc-discord-login',
    'core',
    'dbg_reconnect'
]
  1. Listen for crc-discord-login-finish event.

When a bearer token is passed from a client you will get general Discord information through an alt.on event.

You should be listening to this event from some other resource.

interface Account {
    // MongoDB Document ID
    _id: string;
    // Discord Data
    id: string;
    username: string;
    discriminator: number;
}

alt.on('crc-discord-login-finish', (player: alt.Player, account: Account) => {
    player.frozen = false;
    player.model = 'mp_m_freemode_01';
    player.visible = true;
    player.spawn(0, 0, 72);
    console.log(account);
});

About

alt:V discord login resource with cross resource compatibility

Topics

Resources

Stars

Watchers

Forks