Skip to content

Commit

Permalink
chore: test redirectTo
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdin committed Jun 2, 2024
1 parent 08f5179 commit a44a7cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineNuxtConfig({
},
runtimeConfig: {
public: {
sitURL: process.env.VERCEL_URL || 'http://localhost:3000',
sitURL: `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` || 'http://localhost:3000',
},
},
nitro: {
Expand Down
11 changes: 5 additions & 6 deletions pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ const loading = ref(false)
const user = useSupabaseUser()
const supabase = useSupabaseClient()
const config = useRuntimeConfig();
const singInWithPassword = async (e: Event) => {
e.preventDefault()
try {
loading.value = true
const { data, error } = await supabase.auth.signInWithPassword(formData)
const { error } = await supabase.auth.signInWithPassword(formData)
if (error) throw error
console.log('🚀 ~ singInWithPassword ~ data:', data)
} catch (err) {
alert(err)
} finally {
Expand All @@ -42,14 +40,15 @@ const signInWithGithub = async (e: Event) => {
e.preventDefault()
try {
loading.value = true
const { data, error } = await supabase.auth.signInWithOAuth({
const { error } = await supabase.auth.signInWithOAuth({
provider: 'github',
options: {
redirectTo: `${config.public.sitURL}/confirm`,
// Since we are using client-side login, we use window.location.origin as the redirect domain
redirectTo: `${window.location.origin}/confirm/`,
},
})
if (error) throw error
console.log('🚀 ~ signInWithGithub ~ data:', data)
} catch (err) {
alert(err)
} finally {
Expand Down

0 comments on commit a44a7cb

Please sign in to comment.