firebase / firebase/firebase-js-sdk

Firebase Auth - Cordova - iOS - signInWithRedirect - about:blank

Open
#2,103 20 comments 6 reactions 1 assignee Claimed by @sam-gc View on GitHub
api: auth bug stack:Cordova-Ionic
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: iOS
* Browser version: iOS Cordova
* Firebase SDK version: 5
* Firebase Product: auth

### [REQUIRED] Describe the problem

The Firebase / Cordova intergration instructions are now missing a step and without it signInWithRedirect will not redirect back to the app and instead show a blank page with the url about:blank.

This issue arises because the app goes to sleep when the browsertab is opened and it never receives the callback once Facebook / Google / Twitter has authenticated the credentials.

This can be solved by installing the Cordova plugin cordova-plugin-background-mode

The sign if flow should now enable background mode before opening the browsertab and disable it after the process has completed.

```
window.cordova.plugins.backgroundMode.enable();

const auth = await this.get( 'firebaseService' ).auth();

var result = await auth.signInWithRedirect( provider ).then(function() { return auth.getRedirectResult(); }).catch(function( error ) { return self.handleError( error ); });

window.cordova.plugins.backgroundMode.disable();
```

The firebaseService is an Ember intergration and can be replaced with the standard Firebase way.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.