Skip to content

Commit 7946bd7

Browse files
quentinchapdavideast
authored andcommitted
Cordova case (angular#287)
Add work around to cordova case
1 parent 832abb3 commit 7946bd7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/5-user-authentication.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,30 @@ export class RcTestAppComponent {
154154
}
155155
}
156156
```
157+
158+
## Cordova case
159+
160+
Firebase authentication wasn't entirely compatible with cordova. You need to add some specific operations.
161+
162+
**Example:**
163+
164+
Login with Facebook.
165+
166+
1- Install cordova plugin
167+
168+
```cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"```
169+
170+
2- Use signInWithCredential login method
171+
172+
```ts
173+
console.log("Facebook success: " + JSON.stringify(result));
174+
var provider = firebase.auth.FacebookAuthProvider.credential(result.authResponse.accessToken);
175+
176+
firebase.auth().signInWithCredential(provider)
177+
.then((success) => {
178+
console.log("Firebase success: " + JSON.stringify(success));
179+
})
180+
.catch((error) => {
181+
console.log("Firebase failure: " + JSON.stringify(error));
182+
});
183+
```

0 commit comments

Comments
 (0)