Redirect to production for login when on local dev
OAuth PKCE state is origin-scoped — initiating from 127.0.0.1 and receiving callback on coffee.apoena.dev breaks the flow. From local dev, redirect to production login with handle pre-filled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,14 +40,24 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
|
||||||
const auth = useAuthStore()
|
const auth = useAuthStore()
|
||||||
const handle = ref('')
|
const route = useRoute()
|
||||||
|
const handle = ref((route.query.handle as string) ?? '')
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
|
|
||||||
|
const PROD_URL = 'https://coffee.apoena.dev'
|
||||||
|
const isLocalDev = window.location.origin !== PROD_URL
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
|
// OAuth state is scoped to the initiating origin — must start from production
|
||||||
|
if (isLocalDev) {
|
||||||
|
window.location.href = `${PROD_URL}/login?handle=${encodeURIComponent(handle.value.trim())}`
|
||||||
|
return
|
||||||
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user