Skip to content

Commit 8f4b884

Browse files
committed
chore: fix harcoded oauth dev port
When the dev server runs on another port, you can't auth because it redirects back to to port 3000.
1 parent e5ccbff commit 8f4b884

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

config/env.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import Git from 'simple-git'
44
import * as process from 'node:process'
5+
import { useNuxt } from 'nuxt/kit'
56

67
export { version } from '../package.json'
78

@@ -149,13 +150,16 @@ export async function getEnv(isDevelopment: boolean) {
149150
: branch === 'main'
150151
? 'canary'
151152
: 'release'
153+
const nuxt = useNuxt()
154+
const devUrl = isDevelopment ? `http://127.0.0.1:${nuxt.options.devServer.port}` : undefined
152155
const previewUrl = getPreviewUrl()
153156
const productionUrl = getProductionUrl()
154157
return {
155158
commit,
156159
shortCommit,
157160
branch,
158161
env,
162+
devUrl,
159163
previewUrl,
160164
productionUrl,
161165
prNumber,

modules/oauth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export default defineNuxtModule({
1212
async setup() {
1313
const nuxt = useNuxt()
1414

15-
const { previewUrl, productionUrl } = await getEnv(nuxt.options.dev)
16-
const clientUri = productionUrl || previewUrl || 'http://127.0.0.1:3000'
15+
const { devUrl, previewUrl, productionUrl } = await getEnv(nuxt.options.dev)
16+
const clientUri = productionUrl || previewUrl || devUrl || 'http://127.0.0.1:3000'
1717

1818
// bake it into a virtual file
1919
addServerTemplate({

0 commit comments

Comments
 (0)