discord-authorize
Version:
A node module for easy authentication with Discord
22 lines • 900 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateLink = void 0;
const getType_1 = __importDefault(require("../../util/getType"));
function generateLink({ scopes }, state, clientId, redirectUri) {
if ((0, getType_1.default)(state) !== "string") {
throw new TypeError(`Expected type of state to be a 'string' but got ${(0, getType_1.default)(state)} instead.`);
}
const params = new URLSearchParams({
client_id: clientId,
redirect_uri: redirectUri,
response_type: "code",
state: state,
scope: scopes.join(" "),
});
return `https://discord.com/oauth2/authorize?${params}`;
}
exports.generateLink = generateLink;
//# sourceMappingURL=generateLink.js.map