Skip to content

Commit 16561cb

Browse files
authored
Merge pull request #4 from database-playground/pan93412/dbp-11-pass-redirect_uri-in-admin-login
feat: implement new redirect URL pattern
2 parents 7a3b3d0 + 5393b39 commit 16561cb

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

README.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1+
# Database Playground Admin
22

3-
## Getting Started
3+
## Variables
44

5-
First, run the development server:
6-
7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
5+
```env
6+
NEXT_PUBLIC_BACKEND_BASE_URL=
7+
APP_REDIRECT_URL=
158
```
169

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18-
19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20-
21-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22-
23-
## Learn More
24-
25-
To learn more about Next.js, take a look at the following resources:
10+
## Development
2611

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29-
30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31-
32-
## Deploy on Vercel
33-
34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35-
36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
12+
```bash
13+
pnpm codegen:watch
14+
pnpm dev --experimental-https
15+
```

components/login-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function LoginForm({
1919
<CardContent>
2020
<div className="grid gap-6">
2121
<div className="flex flex-col gap-4">
22-
<a href={buildUri("/api/auth/google/login")}>
22+
<a href={buildUri(`/api/auth/google/login?redirect_uri=${process.env.APP_REDIRECT_URL}`)}>
2323
<Button variant="outline" className="w-full">
2424
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2525
<path

lib/build-uri.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default function buildUri(path: string) {
22
const normalizedPath = path.replace(/\/+$/, "");
33

4-
return new URL(normalizedPath, process.env.NEXT_PUBLIC_BACKEND_URL).toString();
4+
return new URL(normalizedPath, process.env.NEXT_PUBLIC_BACKEND_BASE_URL).toString();
55
}

0 commit comments

Comments
 (0)