authmi 1.0.0 → 1.1.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
@@ -149,7 +149,7 @@ Create `middleware.ts` in your project root:
149
149
  import { createAuthMiMiddleware } from "authmi/next";
150
150
 
151
151
  export const middleware = createAuthMiMiddleware({
152
- baseUrl: process.env.EASY_AUTH_URL!,
152
+ baseUrl: process.env.AUTHMI_URL!,
153
153
  protectedPaths: ["/dashboard", "/profile", "/settings"],
154
154
  authPaths: ["/login", "/signup"],
155
155
  loginPath: "/login",
@@ -169,7 +169,7 @@ import { withAuth, withScope } from "authmi/next";
169
169
 
170
170
  // Any authenticated user
171
171
  export const GET = withAuth(
172
- { baseUrl: process.env.EASY_AUTH_URL! },
172
+ { baseUrl: process.env.AUTHMI_URL! },
173
173
  async (request, { userId, scope }) => {
174
174
  return NextResponse.json({
175
175
  message: "Hello user!",
@@ -180,7 +180,7 @@ export const GET = withAuth(
180
180
 
181
181
  // Admin only
182
182
  export const POST = withScope(
183
- { baseUrl: process.env.EASY_AUTH_URL! },
183
+ { baseUrl: process.env.AUTHMI_URL! },
184
184
  ["admin"], // Only admins
185
185
  async (request, { userId }) => {
186
186
  return NextResponse.json({
@@ -196,8 +196,8 @@ export const POST = withScope(
196
196
  import { createServerClient } from "authmi/next";
197
197
 
198
198
  const serverClient = createServerClient({
199
- baseUrl: process.env.EASY_AUTH_URL!,
200
- apiKey: process.env.EASY_AUTH_API_KEY!, // Server-only
199
+ baseUrl: process.env.AUTHMI_URL!,
200
+ apiKey: process.env.AUTHMI_API_KEY!, // Server-only
201
201
  });
202
202
 
203
203
  // Create a user
@@ -366,7 +366,7 @@ Common error codes:
366
366
  import { createAuthMiMiddleware } from "authmi/next";
367
367
 
368
368
  export const middleware = createAuthMiMiddleware({
369
- baseUrl: process.env.EASY_AUTH_URL!,
369
+ baseUrl: process.env.AUTHMI_URL!,
370
370
  protectedPaths: ["/api/protected"],
371
371
  });
372
372
 
@@ -379,7 +379,7 @@ import { NextResponse } from "next/server";
379
379
  import { withAuth } from "authmi/next";
380
380
 
381
381
  export const GET = withAuth(
382
- { baseUrl: process.env.EASY_AUTH_URL! },
382
+ { baseUrl: process.env.AUTHMI_URL! },
383
383
  async (request, { userId, scope }) => {
384
384
  // User is authenticated!
385
385
  return NextResponse.json({