Skip to content

Signin With Redirect not working #1621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Johnnyevans32 opened this issue Apr 16, 2025 · 5 comments
Open

Signin With Redirect not working #1621

Johnnyevans32 opened this issue Apr 16, 2025 · 5 comments

Comments

@Johnnyevans32
Copy link

Reproduction

https://github.com/posva/nuxt--vuefire-example-spark-plan

Steps to reproduce the bug

  1. trigger signInWithRedirect(provider) from firebase auth.

  2. redirect to the oauth provider (e.g., twitter).

  3. sign in successfully.

  4. user is redirected back but not logged in.

  5. no persistent auth state or missing result from getRedirectResult().

Screenrecorder-2025-04-16-03-29-39-789.mp4

Expected behavior

after returning from the oauth provider, calling getRedirectResult() should yield the current user state and the auth state should persist across reloads.

Actual behavior

the app reloads and useCurrentUser() returns null

getRedirectResult() doesn't resolve the user

persistence appears broken, even when set to local

Additional information

signInWithPopup() works fine

@krthr
Copy link

krthr commented Apr 20, 2025

It's happening to me

@rtxd
Copy link

rtxd commented Apr 21, 2025

Same for me

@aligu7
Copy link

aligu7 commented May 2, 2025

Same issue. signInWithPopup works but signInWithRedirect doesn't:

<script setup lang="ts">
import { getRedirectResult, signInWithRedirect, GoogleAuthProvider } from 'firebase/auth'
import { useFirebaseAuth } from 'vuefire'

const auth = useFirebaseAuth()

function signInWithGoogle() {
  signInWithRedirect(auth, new GoogleAuthProvider())
}
</script>

@aligu7
Copy link

aligu7 commented May 5, 2025

@Johnnyevans32 , this fixes the issue for me: https://stackoverflow.com/questions/77270210/firebase-onauthstatechanged-user-returns-null-when-on-localhost

@davidstackio
Copy link
Contributor

This is more of a firebase issue, not a vuefire issue. I've been experiencing this for years in development. What I do is something like this in my imports, then toggle the comment when I need to login to test.

import {
  GoogleAuthProvider,
  // signInWithPopup, // use this with localhost, still might need to refresh or manually update address bar
  signInWithRedirect,
} from "firebase/auth";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants