Skip to content

Commit

Permalink
Cordova case (angular#287)
Browse files Browse the repository at this point in the history
Add work around to cordova case
  • Loading branch information
quentinchap authored and davideast committed Jul 11, 2016
1 parent 832abb3 commit 7946bd7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/5-user-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,30 @@ export class RcTestAppComponent {
}
}
```

## Cordova case

Firebase authentication wasn't entirely compatible with cordova. You need to add some specific operations.

**Example:**

Login with Facebook.

1- Install cordova plugin

```cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"```

2- Use signInWithCredential login method

```ts
console.log("Facebook success: " + JSON.stringify(result));
var provider = firebase.auth.FacebookAuthProvider.credential(result.authResponse.accessToken);

firebase.auth().signInWithCredential(provider)
.then((success) => {
console.log("Firebase success: " + JSON.stringify(success));
})
.catch((error) => {
console.log("Firebase failure: " + JSON.stringify(error));
});
```

0 comments on commit 7946bd7

Please sign in to comment.