Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 9 additions & 26 deletions packages/nextjs/QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,13 @@ ASGARDEO_CLIENT_SECRET="<your-app-client-secret>"

Create a `middleware.ts` file in your project root to handle authentication:

```bash
import { AsgardeoNext } from '@asgardeo/nextjs';
import { NextRequest } from 'next/server';

const asgardeo = new AsgardeoNext();
> **Note on Next.js 16 compatibility:**
> Next.js 16 renamed `middleware.ts` to `proxy.ts`. The `@asgardeo/nextjs` SDK currently supports the `middleware.ts` export pattern. Support for Next.js 16's `proxy.ts` may be added in a future SDK release.

asgardeo.initialize({
baseUrl: process.env.NEXT_PUBLIC_ASGARDEO_BASE_URL,
clientId: process.env.NEXT_PUBLIC_ASGARDEO_CLIENT_ID,
clientSecret: process.env.ASGARDEO_CLIENT_SECRET,
});
```bash
import { asgardeoMiddleware } from '@asgardeo/nextjs/server';

export async function middleware(request: NextRequest) {
return await asgardeo.middleware(request);
}
export default asgardeoMiddleware();

export const config = {
matcher: [
Expand Down Expand Up @@ -219,21 +211,12 @@ If you want to use an embedded login page instead of redirecting to Asgardeo, yo
Configure the path of the sign-in page in the `middleware.ts` file:

```diff
import { AsgardeoNext } from '@asgardeo/nextjs';
import { NextRequest } from 'next/server';
import { asgardeoMiddleware } from '@asgardeo/nextjs/server';

const asgardeo = new AsgardeoNext();

asgardeo.initialize({
baseUrl: process.env.NEXT_PUBLIC_ASGARDEO_BASE_URL,
clientId: process.env.NEXT_PUBLIC_ASGARDEO_CLIENT_ID,
clientSecret: process.env.ASGARDEO_CLIENT_SECRET,
-export default asgardeoMiddleware();
+export default asgardeoMiddleware({
+ signInUrl: '/signin',
});

export async function middleware(request: NextRequest) {
return await asgardeo.middleware(request);
}
+});
Comment thread
coderabbitai[bot] marked this conversation as resolved.

export const config = {
matcher: [
Expand Down