Skip to content

Commit ddd123d

Browse files
committed
Replace GOOGLE_REDIRECT_URI
1 parent e9ad8f5 commit ddd123d

10 files changed

Lines changed: 45 additions & 60 deletions

File tree

.github/workflows/deploy_production.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ env:
1919
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
2020
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
2121
OIDC_ISSUER_URL: ${{ secrets.OIDC_ISSUER_URL }}
22-
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
2322
NEXT_PUBLIC_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_PUBLIC_POSTHOG_KEY }}
2423
PLANNER_CLIENT_API_KEY: ${{ secrets.PLANNER_CLIENT_API_KEY }}
25-
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2624
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
25+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2726

2827
jobs:
2928
deploy-production:

.github/workflows/deploy_staging.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ env:
2121
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
2222
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
2323
OIDC_ISSUER_URL: ${{ secrets.OIDC_ISSUER_URL }}
24-
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
2524
NEXT_PUBLIC_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_PUBLIC_POSTHOG_KEY }}
2625
PLANNER_CLIENT_API_KEY: ${{ secrets.PLANNER_CLIENT_API_KEY }}
27-
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2826
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
27+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2928

3029
jobs:
3130
deploy-staging:

.github/workflows/deploy_staging_shared.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ env:
1717
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
1818
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
1919
OIDC_ISSUER_URL: ${{ secrets.OIDC_ISSUER_URL }}
20-
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
2120
PLANNER_CLIENT_API_KEY: ${{ secrets.PLANNER_CLIENT_API_KEY }}
2221
NEXT_PUBLIC_PUBLIC_POSTHOG_KEY: ${{ secrets.NEXT_PUBLIC_PUBLIC_POSTHOG_KEY }}
23-
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2422
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
23+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2524

2625
jobs:
2726
deploy-staging-shared:

.github/workflows/destroy_staging.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ env:
1919
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
2020
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }}
2121
OIDC_ISSUER_URL: ${{ secrets.OIDC_ISSUER_URL }}
22-
GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }}
2322
PLANNER_CLIENT_API_KEY: ${{ secrets.PLANNER_CLIENT_API_KEY }}
24-
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2523
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
24+
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
2625

2726
jobs:
2827
delete-staging:

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
AntAlmanac is a schedule planner website for classes at UC Irvine. These are some of its features:
66

7-
- **_Search bar_** to easily find classes by department (e.g COMPSCI), section code (e.g. 36040), and keywords (e.g. artificial intelligence).
8-
- **_Integrated calendar_** to preview class times.
9-
- **_Quick links_** to professor reviews, prerequisites, grade distributions, and past enrollment data.
10-
- **_Interactive map_** with markers for your class locations.
7+
- **_Search bar_** to easily find classes by department (e.g COMPSCI), section code (e.g. 36040), and keywords (e.g. artificial intelligence).
8+
- **_Integrated calendar_** to preview class times.
9+
- **_Quick links_** to professor reviews, prerequisites, grade distributions, and past enrollment data.
10+
- **_Interactive map_** with markers for your class locations.
1111

1212
![project screenshot](https://github.com/user-attachments/assets/e1f8d3ce-8188-41ab-817a-850e51e6bd1a)
1313

@@ -18,26 +18,26 @@ A summary of the libraries we use are listed below.
1818

1919
### Frontend
2020

21-
- [Next.js](https://nextjs.org) - React framework with server-side rendering.
22-
- [MUI](https://mui.com) - React UI library.
23-
- [React Big Calendar](https://github.com/jquense/react-big-calendar) - React calendar component.
24-
- [Recharts](https://recharts.org/en-US) - React chart component.
25-
- [Leaflet](https://leafletjs.com) - Interactive JS maps.
26-
- [Zustand](https://docs.pmnd.rs/zustand/getting-started/introduction) - State management.
21+
- [Next.js](https://nextjs.org) - React framework with server-side rendering.
22+
- [MUI](https://mui.com) - React UI library.
23+
- [React Big Calendar](https://github.com/jquense/react-big-calendar) - React calendar component.
24+
- [Recharts](https://recharts.org/en-US) - React chart component.
25+
- [Leaflet](https://leafletjs.com) - Interactive JS maps.
26+
- [Zustand](https://docs.pmnd.rs/zustand/getting-started/introduction) - State management.
2727

2828
### Backend
2929

30-
- [tRPC](https://trpc.io) - type-safe API access layer for the AntAlmanac API.
31-
- [Anteater API](https://docs.icssc.club/docs/about/anteaterapi) - API maintained by ICSSC for retrieving UCI data.
32-
- [Drizzle ORM](https://orm.drizzle.team/) - [high-performance](https://orm.drizzle.team/benchmarks) type-safe SQL-like access layer compatible with all major SQL dialects.
33-
- [PostgreSQL](https://www.postgresql.org) - Relational database for storing user data and schedules.
30+
- [tRPC](https://trpc.io) - type-safe API access layer for the AntAlmanac API.
31+
- [Anteater API](https://docs.icssc.club/docs/about/anteaterapi) - API maintained by ICSSC for retrieving UCI data.
32+
- [Drizzle ORM](https://orm.drizzle.team/) - [high-performance](https://orm.drizzle.team/benchmarks) type-safe SQL-like access layer compatible with all major SQL dialects.
33+
- [PostgreSQL](https://www.postgresql.org) - Relational database for storing user data and schedules.
3434

3535
### Tooling
3636

37-
- [SST](https://sst.dev) - Infrastructure as code framework for AWS deployment.
38-
- [Docker](https://www.docker.com) - Containerization for local database development.
39-
- [Vitest](https://vitest.dev) - Test runner.
40-
- [TypeScript](https://www.typescriptlang.org) - JavaScript with type-checking.
37+
- [SST](https://sst.dev) - Infrastructure as code framework for AWS deployment.
38+
- [Docker](https://www.docker.com) - Containerization for local database development.
39+
- [Vitest](https://vitest.dev) - Test runner.
40+
- [TypeScript](https://www.typescriptlang.org) - JavaScript with type-checking.
4141

4242
## History
4343

@@ -98,7 +98,6 @@ If you ever need help, feel free to ask around on our [Discord server](https://d
9898
This is best done with a version manager that allows you to easily switch between
9999
Node.js versions based on the requirements of different projects.
100100
Try using any of the following.
101-
102101
- [nvm](https://github.com/nvm-sh/nvm) - Node-Version-Manager.
103102
- [fnm](https://github.com/Schniz/fnm) - Fast-Node-Manager.
104103
- [nvm-windows](https://github.com/coreybutler/nvm-windows)
@@ -165,26 +164,26 @@ If you ever need help, feel free to ask around on our [Discord server](https://d
165164

166165
### Additional Commands
167166

168-
- **Database Studio**: Open Drizzle Studio to view and manage your local database.
167+
- **Database Studio**: Open Drizzle Studio to view and manage your local database.
169168

170169
```bash
171170
pnpm db:studio
172171
```
173172

174-
- **Generate Database Migrations**: After modifying the database schema, generate a new migration.
173+
- **Generate Database Migrations**: After modifying the database schema, generate a new migration.
175174

176175
```bash
177176
pnpm db:generate
178177
```
179178

180-
- **Run Tests**: Execute the test suite.
179+
- **Run Tests**: Execute the test suite.
181180
```bash
182181
pnpm test
183182
```
184183

185184
### Notes
186185

187-
- For more detailed information, see the [frontend README](/apps/antalmanac/README.md).
186+
- For more detailed information, see the [frontend README](/apps/antalmanac/README.md).
188187

189188
## Testing
190189

@@ -196,8 +195,8 @@ AntAlmanac is deployed to AWS using [SST (Serverless Stack)](https://sst.dev). T
196195

197196
### Deployment Environments
198197

199-
- **Production**: Deployed to `sst.antalmanac.com`
200-
- **Staging**: Deployed to `staging-{PR_NUMBER}.antalmanac.com` for pull request previews
198+
- **Production**: Deployed to `sst.antalmanac.com`
199+
- **Staging**: Deployed to `staging-{PR_NUMBER}.antalmanac.com` for pull request previews
201200

202201
### Deploying to Production
203202

@@ -219,13 +218,14 @@ This command runs `sst deploy --stage production` which:
219218

220219
The following environment variables are required for deployment and should be configured in your AWS environment or CI/CD pipeline:
221220

222-
- `DB_URL` - Database connection string
223-
- `MAPBOX_ACCESS_TOKEN` - Mapbox API token for map features
224-
- `NEXT_PUBLIC_TILES_ENDPOINT` - Endpoint for map tiles
225-
- `ANTEATER_API_KEY` - API key for Anteater API
226-
- `OIDC_CLIENT_ID` - OAuth client ID for Google authentication
227-
- `OIDC_ISSUER_URL` - OAuth issuer URL
228-
- `GOOGLE_REDIRECT_URI` - OAuth redirect URI (automatically set based on stage)
221+
- `DB_URL` - Database connection string
222+
- `MAPBOX_ACCESS_TOKEN` - Mapbox API token for map features
223+
- `NEXT_PUBLIC_TILES_ENDPOINT` - Endpoint for map tiles
224+
- `ANTEATER_API_KEY` - API key for Anteater API
225+
- `OIDC_CLIENT_ID` - OAuth client ID for Google authentication
226+
- `OIDC_ISSUER_URL` - OAuth issuer URL
227+
- `BETTER_AUTH_URL` - URL used for OAuth (automatically set based on stage)
228+
- `BETTER_AUTH_SECRET` - OAuth secret key, you can generate one [here](https://better-auth.com/docs/installation#set-environment-variables)
229229

230230
# Troubleshooting
231231

@@ -237,9 +237,9 @@ into a globally accessible location like `/bin`, which needs admin permissions t
237237
The best way to resolve this is to install Node via any version manager to properly handle
238238
these sorts of permissions. Here are the different version managers again.
239239

240-
- [nvm](https://github.com/nvm-sh/nvm) - Node-Version-Manager.
241-
- [fnm](https://github.com/Schniz/fnm) - Fast-Node-Manager.
242-
- [nvm-windows](https://github.com/coreybutler/nvm-windows)
240+
- [nvm](https://github.com/nvm-sh/nvm) - Node-Version-Manager.
241+
- [fnm](https://github.com/Schniz/fnm) - Fast-Node-Manager.
242+
- [nvm-windows](https://github.com/coreybutler/nvm-windows)
243243

244244
A more convenient, but less secure way to resolve this is to run the command with admin privileges, e.g with `sudo`.
245245

apps/antalmanac/.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ ANTEATER_API_KEY=
44
DB_URL="postgres://postgres:postgres@localhost:5432/antalmanac"
55
OIDC_CLIENT_ID=antalmanac-dev
66
OIDC_ISSUER_URL=https://auth.icssc.club
7-
GOOGLE_REDIRECT_URI=http://localhost:3000/auth
8-
BETTER_AUTH_SECRET=
97
BETTER_AUTH_URL=http://localhost:3000
8+
BETTER_AUTH_SECRET=

apps/antalmanac/src/backend/env.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ dotenv.config();
99
export const oidcOAuthEnvSchema = z.object({
1010
OIDC_CLIENT_ID: z.string(),
1111
OIDC_ISSUER_URL: z.string(),
12-
GOOGLE_REDIRECT_URI: z.string(),
13-
});
14-
15-
/**
16-
* Environment variables required for better-auth
17-
*/
18-
export const betterAuthEnvSchema = z.object({
1912
BETTER_AUTH_SECRET: z.string(),
2013
BETTER_AUTH_URL: z.string(),
2114
});
@@ -63,7 +56,6 @@ export const backendEnvSchema = z
6356
.object({})
6457
.merge(stagingEnvSchema)
6558
.merge(oidcOAuthEnvSchema)
66-
.merge(betterAuthEnvSchema)
6759
.merge(rdsEnvSchema)
6860
.merge(mapboxEnvSchema)
6961
.merge(aapiEnvSchema)

apps/antalmanac/src/backend/routers/userData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { db } from '@packages/db';
66
import { TRPCError } from '@trpc/server';
77
import { z } from 'zod';
88

9-
const { OIDC_ISSUER_URL, GOOGLE_REDIRECT_URI } = oidcOAuthEnvSchema.parse(process.env);
9+
const { OIDC_ISSUER_URL, BETTER_AUTH_URL } = oidcOAuthEnvSchema.parse(process.env);
1010

1111
const userDataRouter = router({
1212
getUserAndAccount: protectedProcedure.query(async ({ ctx }) => {
@@ -74,7 +74,7 @@ const userDataRouter = router({
7474
*/
7575
getLogoutUrl: procedure.input(z.object({ redirectUrl: z.string().optional() })).query(async ({ input }) => {
7676
const oidcLogoutUrl = new URL(`${OIDC_ISSUER_URL}/logout`);
77-
const redirectTo = input.redirectUrl || GOOGLE_REDIRECT_URI.replace('/auth', '');
77+
const redirectTo = input.redirectUrl || BETTER_AUTH_URL;
7878
oidcLogoutUrl.searchParams.set('post_logout_redirect_uri', redirectTo);
7979
return oidcLogoutUrl.toString();
8080
}),

apps/antalmanac/src/lib/auth/auth.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import 'server-only';
22
import { getSafeAuthRedirectPath } from '$lib/auth/authUtils';
33
import { AUTH_PROVIDER_ID } from '$lib/constants';
4-
import { oidcOAuthEnvSchema, betterAuthEnvSchema } from '$src/backend/env';
4+
import { oidcOAuthEnvSchema } from '$src/backend/env';
55
import { db } from '@packages/db';
66
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
77
import { createAuthMiddleware, getOAuthState } from 'better-auth/api';
88
import { betterAuth } from 'better-auth/minimal';
99
import { nextCookies } from 'better-auth/next-js';
1010
import { genericOAuth } from 'better-auth/plugins';
1111

12-
const { OIDC_CLIENT_ID, OIDC_ISSUER_URL } = oidcOAuthEnvSchema.parse(process.env);
13-
const { BETTER_AUTH_URL } = betterAuthEnvSchema.parse(process.env);
12+
const { OIDC_CLIENT_ID, OIDC_ISSUER_URL, BETTER_AUTH_URL } = oidcOAuthEnvSchema.parse(process.env);
1413

1514
export interface AuthAdditionalData {
1615
returnUrl?: string;

sst.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ export default $config({
5858
ANTEATER_API_KEY: process.env.ANTEATER_API_KEY,
5959
OIDC_CLIENT_ID: process.env.OIDC_CLIENT_ID,
6060
OIDC_ISSUER_URL: process.env.OIDC_ISSUER_URL,
61-
GOOGLE_REDIRECT_URI: `https://${domain}/auth`,
61+
BETTER_AUTH_URL: `https://${domain}`,
6262
BETTER_AUTH_SECRET: process.env.BETTER_AUTH_SECRET,
63-
BETTER_AUTH_URL: process.env.BETTER_AUTH_URL,
6463
NEXT_PUBLIC_BASE_URL: domain,
6564
NEXT_PUBLIC_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_PUBLIC_POSTHOG_KEY,
6665
PLANNER_CLIENT_API_KEY: process.env.PLANNER_CLIENT_API_KEY,

0 commit comments

Comments
 (0)