react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

firebase.auth(...).getRedirectResult is not a function after setup (with redux)

Open NathHorrigan opened this issue 9 years ago • 14 comments

Issue

I get the following error firebase.auth(...).getRedirectResult is not a function after following the guide to setup library - I also followed the redux setup guide.

Environment

  1. Application Target Platform: Android
  1. Development Operating System: macOS Sierra
  1. Build Tools: Android SDK 26.0.1
  1. React Native version: react-native-cli: 2.0.1 react-native: 0.48.3
  1. RNFirebase Version: 2.2.0
  1. Firebase Module: All

NathHorrigan avatar Sep 21 '17 08:09 NathHorrigan

@NathHorrigan getRedirectResult is not supported in react-native-firebase as it's not possible to use redirect-based sign in flows in React Native. Assuming you're trying to do Facebook or Google sign in, you'll need to get the credential using a third party library, e.g. react-native-fbsdk or react-native-google-signinthen use the signInWithCredential or linkWithCredential methods that react-native-firebase exposes.

chrisbianca avatar Sep 21 '17 08:09 chrisbianca

But I'm not calling any auth methods. I have just setup and installed react-native-firebase - nothing else.

NathHorrigan avatar Sep 21 '17 08:09 NathHorrigan

What other third party libraries are you using? One of these must be trying to call that method...

chrisbianca avatar Sep 21 '17 09:09 chrisbianca

Must have been some sort of cached file. The problem resolved itself after I resaved and built some files. Thanks for your help anyhow!

NathHorrigan avatar Sep 21 '17 09:09 NathHorrigan

No probs

chrisbianca avatar Sep 21 '17 09:09 chrisbianca

@chrisbianca Actually the error has reappeared but only when using remote JS debugging 😕

NathHorrigan avatar Sep 22 '17 12:09 NathHorrigan

Sounds like a weird caching issue to me, or there is something using it in the background.

As an FYI, this has prompted us to make some changes in v3 to make it clear which methods we don't support because the native SDKs don't support them. This is one of them.

chrisbianca avatar Sep 24 '17 11:09 chrisbianca

This is still happening on all 3 browsers that I have tested (Chrome Canary, Chrome Stable, Firefox Dev edition)

NathHorrigan avatar Sep 27 '17 17:09 NathHorrigan

Faced the same issue if I enable Remote JS Debugging.

I didn't call any auth() method at all.

"react-native": "^0.48.3" "react-native-firebase": "^2.2.2" "react-redux-firebase": "^2.0.0-beta.8"

I think the issue comes from react-redux-firebase.

kkkevinnn avatar Sep 29 '17 03:09 kkkevinnn

@NathHorrigan @hisokakei This looks like it's something internal to react-redux-firebase as per the below:

https://github.com/prescottprue/react-redux-firebase/blob/ed6b902aee8ca225b02e307b71ff1b93b4f9f6fe/src/actions/auth.js#L268

@prescottprue GetRedirectResult isn't supported by the native SDKs - how can these guys work around the issue? It looks like there's a config flag which might be possible to disable?

chrisbianca avatar Sep 29 '17 07:09 chrisbianca

@chrisbianca If we can know with confidence that it is this type of environment (i.e. an instance of react-native-firebase instead of regular firebase) than we could possibly call whatever interaction react-native-fbsdk needs. I would need to look a little more into it.

The current react-native example for v1.*.* of react-redux-firebase uses react-native-google-signin along with the Firebase JS library to make things work. I'm wondering if we can do something similar internally, but it would be ideal to keep it from adding dependencies for those who are not using react-native.

This issue on react-redux-firebase may be related, though the explanation seems a little different, so maybe not.

Either way, since OAuth with react-native-firebase seems to be an ongoing issue for multiple people, I am going to prioritize it on the v2 roadmap for react-redux-firebase.

prescottprue avatar Sep 29 '17 17:09 prescottprue

So what is the temporary fix for this?? My firebase setup itself is working - I have a working google signin (with firebase) that works when not remote debugging.

NathHorrigan avatar Sep 30 '17 12:09 NathHorrigan

@NathHorrigan Did you provide enableRedirectHandling: false? If you are using the most recent v2.0.0-* pre-release, it shouldn't be necessary.

Since it relates to your usage with react-redux-firebase, lets track solving it in an issue on there so that this closed issue does not keep getting updated.

prescottprue avatar Oct 02 '17 07:10 prescottprue

Use enableRedirectHandling=false in reduxFirebaseConfig for reactReduxFirebase function from 'react-redux-firebase'

shivanshrajpoot avatar Feb 21 '19 11:02 shivanshrajpoot