Skip to content

Commit

Permalink
fix(oauth-url): fallback to vercel url
Browse files Browse the repository at this point in the history
fallback to vercel url
  • Loading branch information
snomiao committed Jul 11, 2024
1 parent 37d1ba0 commit 47eef75
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/gcloud/getAuthenticatedClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,7 @@ export async function getAuthenticatedClient({
new OAuth2Client(
process.env.AUTH_GOOGLE_ID || DIE`MISSING env.AUTH_GOOGLE_ID`,
process.env.AUTH_GOOGLE_SECRET || DIE`MISSING env.AUTH_GOOGLE_SECRET`,
`${
new URL(
process.env.AUTH_GCLOUD_URL ??
process.env.AUTH_URL ??
DIE`\
Missding env.API_AUTH_URL, \
Please choose one from web.keys.redirect_uris \
And fill API_AUTH_URL into .env.local.
Make sure path has "/api/oauth/gcloud"
`,
).origin
}/api/oauth/gcloud`,
getGCloudOAuth2RedirectUri(),
);
// Generate the url that will be used for the consent dialog.
const authorizeUrl = getOAuth2Client().generateAuthUrl({
Expand Down Expand Up @@ -83,6 +72,7 @@ export function getGCloudOAuth2RedirectUri(): string {
new URL(
process.env.AUTH_GCLOUD_URL ??
process.env.AUTH_URL ??
process.env.VERCEL_URL ??
DIE`\
Missding env.API_AUTH_URL, \
Please choose one from web.keys.redirect_uris \
Expand Down

0 comments on commit 47eef75

Please sign in to comment.