@mikandev/next-discord-auth 0.1.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,32 @@
1
- # next-discord-auth
1
+ # Next Discord Auth
2
2
 
3
- To install dependencies:
3
+ <p align="center">
4
+ <img src="https://cdn.mikn.dev/branding/mikan-vtube.svg" width="100">
5
+ </p>
4
6
 
5
- ```bash
6
- bun install
7
- ```
7
+ <p align="center">JWT-based Discord authentication for Next.js that doesn't suck</p>
8
+
9
+ - Works with Next.js 15
10
+ - No database required
11
+ - Returns **all** user data from Discord
12
+ - Fully server-side
13
+ - Support for Server Actions and Route Handlers
14
+ - Designed for easy migration from AuthJS
8
15
 
9
- To run:
16
+ ## Installation
10
17
 
11
18
  ```bash
12
- bun run index.ts
19
+ npm install @mikandev/next-discord-auth
13
20
  ```
14
21
 
15
- This project was created using `bun init` in bun v1.2.8. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
22
+ ## Demo
23
+ You can see a live demo of this package in action at <br>
24
+ [https://next-discord-auth-demo.maamokun.workers.dev](https://next-discord-auth-demo.maamokun.workers.dev)
25
+
26
+ ## Open Source
27
+ This package is open source and available under the [WTFPL License](https://wtfpl.net/).<br>
28
+ Feel free to [contribute](https://github.com/mikndotdev/next-discord-auth) or use it in your projects!
29
+
30
+ ## Learn More
31
+ - [Documentation](https://docs.mikn.dev/solutions/developers/next-discord-auth)
32
+ - [Product Page](https://mikn.dev/solutions/developers/next-discord-auth)
@@ -27,19 +27,11 @@ export const signIn = async () => {
27
27
  return redirect(signInURL);
28
28
  };
29
29
  export const signOut = async () => {
30
- const config = getGlobalConfig();
31
30
  const cookieStore = await cookies();
32
31
  const token = cookieStore.get("AUTH_SESSION")?.value;
33
32
  if (!token) {
34
33
  return NextResponse.json({ message: "Not signed in" }, { status: 401 });
35
34
  }
36
- try {
37
- jwt.verify(token, config.jwtSecret);
38
- }
39
- catch {
40
- return NextResponse.json({ message: "Invalid session" }, { status: 401 });
41
- }
42
- const response = NextResponse.json({ message: "Signed out successfully" }, { status: 200 });
43
- response.cookies.delete("AUTH_SESSION");
44
- return response;
35
+ cookieStore.delete("AUTH_SESSION");
36
+ return NextResponse.json({ message: "Signed out successfully" }, { status: 200 });
45
37
  };
package/package.json CHANGED
@@ -4,13 +4,24 @@
4
4
  "module": "dist/index.ts",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "license": "WTFPL",
9
- "version": "0.1.4",
11
+ "version": "1.0.0",
10
12
  "type": "module",
13
+ "keywords": [
14
+ "auth",
15
+ "discord",
16
+ "nextjs",
17
+ "nextjs-auth",
18
+ "next-discord-auth",
19
+ "oauth",
20
+ "oauth2"
21
+ ],
11
22
  "repository": {
12
23
  "type": "git",
13
- "url": "https://github.com/mikndotdev/next-discord-auth"
24
+ "url": "git+https://github.com/mikndotdev/next-discord-auth.git"
14
25
  },
15
26
  "homepage": "https://mikn.dev/solutions/developers/next-discord-auth",
16
27
  "scripts": {
@@ -50,8 +61,12 @@
50
61
  },
51
62
  "typesVersions": {
52
63
  "*": {
53
- "redirect": ["dist/types/redirect.d.ts"],
54
- "server-actions": ["dist/types/server-actions.d.ts"]
64
+ "redirect": [
65
+ "dist/types/redirect.d.ts"
66
+ ],
67
+ "server-actions": [
68
+ "dist/types/server-actions.d.ts"
69
+ ]
55
70
  }
56
71
  }
57
72
  }