Socket
Socket
Sign inDemoInstall

remix-auth-discord

Package Overview
Dependencies
2
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

17

build/index.d.ts

@@ -7,3 +7,3 @@ import type { StrategyVerifyCallback } from "remix-auth";

*/
export declare type DiscordScope = "activities.read" | "activities.write" | "applications.builds.read" | "applications.builds.upload" | "applications.commands" | "applications.commands.update" | "applications.entitlements" | "applications.store.update" | "bot" | "connections" | "email" | "gdm.join" | "guilds" | "guilds.join" | "guilds.members.read" | "identify" | "messages.read" | "relationships.read" | "rpc" | "rpc.activities.write" | "rpc.notifications.read" | "rpc.voice.read" | "rpc.voice.write" | "webhook.incoming";
export type DiscordScope = "activities.read" | "activities.write" | "applications.builds.read" | "applications.builds.upload" | "applications.commands" | "applications.commands.update" | "applications.entitlements" | "applications.store.update" | "bot" | "connections" | "dm_channels.read" | "email" | "gdm.join" | "guilds" | "guilds.join" | "guilds.members.read" | "identify" | "messages.read" | "relationships.read" | "role_connections.write" | "rpc" | "rpc.activities.write" | "rpc.notifications.read" | "rpc.voice.read" | "rpc.voice.write" | "voice" | "webhook.incoming";
/**

@@ -13,3 +13,3 @@ * These are all the available Guild Features

*/
declare type DiscordGuildFeature = "ANIMATED_BANNER" | "ANIMATED_ICON" | "APPLICATION_COMMAND_PERMISSIONS_V2" | "AUTO_MODERATION" | "BANNER" | "COMMUNITY" | "DEVELOPER_SUPPORT_SERVER" | "DISCOVERABLE" | "FEATURABLE" | "INVITES_DISABLED" | "INVITE_SPLASH" | "MEMBER_VERIFICATION_GATE_ENABLED" | "MONETIZATION_ENABLED" | "MORE_STICKERS" | "NEWS" | "PARTNERED" | "PREVIEW_ENABLED" | "ROLE_ICONS" | "TICKETED_EVENTS_ENABLED" | "VANITY_URL" | "VERIFIED" | "VIP_REGIONS" | "WELCOME_SCREEN_ENABLED";
type DiscordGuildFeature = "ANIMATED_BANNER" | "ANIMATED_ICON" | "APPLICATION_COMMAND_PERMISSIONS_V2" | "AUTO_MODERATION" | "BANNER" | "COMMUNITY" | "CREATOR_MONETIZABLE_PROVISIONAL" | "CREATOR_STORE_PAGE" | "DEVELOPER_SUPPORT_SERVER" | "DISCOVERABLE" | "FEATURABLE" | "INVITES_DISABLED" | "INVITE_SPLASH" | "MEMBER_VERIFICATION_GATE_ENABLED" | "MORE_STICKERS" | "NEWS" | "PARTNERED" | "PREVIEW_ENABLED" | "RAID_ALERTS_DISABLED" | "ROLE_ICONS" | "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" | "ROLE_SUBSCRIPTIONS_ENABLED" | "TICKETED_EVENTS_ENABLED" | "VANITY_URL" | "VERIFIED" | "VIP_REGIONS" | "WELCOME_SCREEN_ENABLED";
/**

@@ -19,3 +19,3 @@ * These are all the available Discord locales

*/
declare type DiscordLocale = "da" | "de" | "en-GB" | "en-US" | "es-ES" | "fr" | "hr" | "it" | "lt" | "hu" | "nl" | "no" | "pl" | "pt-BR" | "ro" | "fi" | "sv-SE" | "vi" | "tr" | "cs" | "el" | "bg" | "ru" | "uk" | "hi" | "th" | "zh-CN" | "ja" | "zh-TW" | "ko";
type DiscordLocale = "id" | "da" | "de" | "en-GB" | "en-US" | "es-ES" | "fr" | "hr" | "it" | "lt" | "hu" | "nl" | "no" | "pl" | "pt-BR" | "ro" | "fi" | "sv-SE" | "vi" | "tr" | "cs" | "el" | "bg" | "ru" | "uk" | "hi" | "th" | "zh-CN" | "ja" | "zh-TW" | "ko";
/**

@@ -75,2 +75,6 @@ * This represents a Discord Guild as returned by the API with the guilds scope enabled.

/**
* The user's display name, if it is set. For bots, this is the application name
*/
global_name: string | null;
/**
* The user's avatar hash

@@ -128,2 +132,7 @@ * @see https://discord.com/developers/docs/reference#image-formatting

public_flags?: number;
/**
* the user's avatar decoration hash
* @see https://discord.com/developers/docs/reference#image-formatting
*/
avatar_decoration?: string | null;
};

@@ -134,3 +143,3 @@ }

name: string;
private scope;
scope: string;
private prompt?;

@@ -137,0 +146,0 @@ private userInfoURL;

@@ -18,3 +18,3 @@ "use strict";

this.userInfoURL = `${discordApiBaseURL}/users/@me`;
this.scope = scope ? scope : ["identify", "email"];
this.scope = (scope !== null && scope !== void 0 ? scope : ["identify", "email"]).join(" ");
this.prompt = prompt;

@@ -24,3 +24,3 @@ }

const params = new URLSearchParams({
scope: this.scope.join(" "),
scope: this.scope,
});

@@ -32,2 +32,3 @@ if (this.prompt)

async userProfile(accessToken) {
var _a;
const response = await fetch(this.userInfoURL, {

@@ -42,3 +43,3 @@ headers: {

id: raw.id,
displayName: raw.username,
displayName: (_a = raw.global_name) !== null && _a !== void 0 ? _a : raw.username,
emails: raw.email ? [{ value: raw.email }] : undefined,

@@ -45,0 +46,0 @@ photos: raw.avatar ? [{ value: raw.avatar }] : undefined,

{
"name": "remix-auth-discord",
"version": "1.2.1",
"version": "1.3.0",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"scripts": {
"prepare": "npm run build",
"build": "tsc --project tsconfig.json",

@@ -25,3 +26,4 @@ "typecheck": "tsc --project tsconfig.json --noEmit",

"package.json",
"README.md"
"README.md",
"LICENSE"
],

@@ -48,30 +50,30 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.14.2",
"@babel/preset-env": "^7.14.1",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@remix-run/node": "^1.0.3",
"@remix-run/react": "^1.1.1",
"@remix-run/server-runtime": "^1.0.0",
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"babel-jest": "^26.6.3",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-jest-dom": "^3.9.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-unicorn": "^32.0.1",
"jest": "^26.6.3",
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@remix-run/node": "^2.1.0",
"@remix-run/react": "^2.1.0",
"@remix-run/server-runtime": "^2.1.0",
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"babel-jest": "^29.7.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.4.3",
"eslint-plugin-jest-dom": "^5.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unicorn": "^48.0.1",
"jest": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.3.2",
"react": "^17.0.2",
"ts-node": "^9.1.1",
"typescript": "^4.3.5"
"prettier": "^3.0.3",
"react": "^18.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {
"remix-auth": "^3.0.0",
"remix-auth-oauth2": "^1.0.0"
"remix-auth": "^3.6.0",
"remix-auth-oauth2": "^1.11.0"
}
}

@@ -46,3 +46,2 @@ # DiscordStrategy

avatar: DiscordProfile["__json"]["avatar"];
discriminator: DiscordProfile["__json"]["discriminator"];
email: DiscordProfile["__json"]["email"];

@@ -89,6 +88,12 @@ guilds?: Array<PartialDiscordGuild>;

* In this example we're only interested in guilds where the user is either the owner or has the `MANAGE_GUILD` permission (This check includes the `ADMINISTRATOR` permission)
* And not interested in the Guild Features
*/
const guilds: Array<PartialDiscordGuild> = userGuilds.filter(
(g) => g.owner || (BigInt(g.permissions) & BigInt(0x20)) == BigInt(0x20)
);
const guilds: Array<PartialDiscordGuild> = userGuilds
.filter(
(g) =>
g.owner || (BigInt(g.permissions) & BigInt(0x20)) == BigInt(0x20),
)
.map(({ features, ...rest }) => {
return { ...rest };
});

@@ -101,11 +106,11 @@ /**

id: profile.id,
displayName: profile.__json.username,
displayName: profile.displayName,
avatar: profile.__json.avatar,
discriminator: profile.__json.discriminator,
email: profile.__json.email,
locale: profile.__json.locale,
accessToken,
refreshToken,
guilds,
refreshToken,
};
}
},
);

@@ -132,3 +137,3 @@

```tsx
// app/routes/auth/discord.tsx
// app/routes/auth.discord.tsx
import type { ActionFunction, LoaderFunction } from "@remix-run/node";

@@ -146,3 +151,3 @@ import { redirect } from "@remix-run/node";

```tsx
// app/routes/auth/discord.callback.tsx
// app/routes/auth.discord.callback.tsx
import type { LoaderFunction } from "@remix-run/node";

@@ -149,0 +154,0 @@ import { auth } from "~/auth.server";

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc