do.ts 505 B

12345678910
  1. import {Request, Response, NextFunction } from "express";
  2. const API_ENDPOINT = "https://discordapp.com/api";
  3. export async function get(req : Request, res : Response, next : NextFunction) {
  4. const CALLBACK_URL = encodeURIComponent(`${process.env.ADMIN_URL}/login/discord/callback`);
  5. const SCOPE = encodeURIComponent("identify");
  6. res.redirect(`${API_ENDPOINT}/oauth2/authorize?client_id=${process.env.BOT_CLIENT_ID}&scope=${SCOPE}&response_type=code&redirect_uri=${CALLBACK_URL}`);
  7. };