mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 00:37:22 +00:00
fix: make scope optional in createOAuth2Link (#5182)
This commit is contained in:
@@ -3,10 +3,9 @@ import { encodeBase64Url } from './base64.js';
|
||||
import { calculateBits } from './permissions.js';
|
||||
|
||||
export function createOAuth2Link(options: CreateOAuth2LinkOptions): string {
|
||||
const joinedScopeString = options.scope.join('%20');
|
||||
|
||||
let url = `https://discord.com/oauth2/authorize?client_id=${options.clientId}&scope=${joinedScopeString}`;
|
||||
let url = `https://discord.com/oauth2/authorize?client_id=${options.clientId}`;
|
||||
|
||||
if (options.scope) url += `&scope=${options.scope.join('%20')}`;
|
||||
if (options.responseType) url += `&response_type=${options.responseType}`;
|
||||
if (options.state) url += `&state=${encodeURIComponent(options.state)}`;
|
||||
if (options.redirectUri) url += `&redirect_uri=${encodeURIComponent(options.redirectUri)}`;
|
||||
@@ -66,7 +65,7 @@ export interface CreateOAuth2LinkOptions {
|
||||
/** The id of the application */
|
||||
clientId: BigString;
|
||||
/** The scopes for the application */
|
||||
scope: OAuth2Scope[];
|
||||
scope?: OAuth2Scope[];
|
||||
/**
|
||||
* The optional state for security
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user