Skip to content

Commit 38db60c

Browse files
authored
Updates to documentation (#21)
* Update Readme.md for Facebook authentication * Update import file for messaging * Fix onTokenRefresh to onToken * Update README.md
1 parent d543e8c commit 38db60c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/firebase-auth/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,13 @@ import { LoginManager, AccessToken } from '@nativescript/facebook';
162162

163163
LoginManager.logInWithPermissions(['public_profile', 'email']).then((result) => {
164164
// Once signed in, get the users AccesToken
165-
const data = await AccessToken.getCurrentAccessToken();
165+
const data = await AccessToken.currentAccessToken();
166166

167167
// Create a Firebase credential with the AccessToken
168-
const facebookCredential = FacebookAuthProvider.credential(data.accessToken);
168+
const facebookCredential = FacebookAuthProvider.credential(data.tokenString);
169169

170170
// Sign-in the user with the credential
171-
return auth().signInWithCredential(facebookCredential);
172-
173-
firebase().auth().signInWithCredential(facebookAuthCredential);
171+
return firebase().auth().signInWithCredential(facebookCredential);
174172
});
175173

176174

@@ -227,7 +225,7 @@ import { GoogleSignin } from '@nativescript/google-signin';
227225
GoogleSignin.configure(); // called earlier in the app
228226

229227
GoogleSignin.signIn().then((user) => {
230-
const credential = GoogleAuthProvider.credential(user.accessToken, user.idToken);
228+
const credential = GoogleAuthProvider.credential(user.idToken, user.accessToken);
231229

232230
firebase().auth().signInWithCredential(credential);
233231
});

packages/firebase-messaging/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This module provides a requestPermission method which triggers a native permissi
2222

2323
```ts
2424
import { firebase } from '@nativescript/firebase-core';
25-
import '@nativescript/firebase-crashlytics'; // only needs to be imported 1x
25+
import '@nativescript/firebase-messaging'; // only needs to be imported 1x
2626

2727
async function requestUserPermission() {
2828
const authStatus = await firebase()
@@ -263,7 +263,7 @@ async function saveTokenToDatabase(token) {
263263

264264

265265
// Listen to whether the token changes
266-
firebase().messaging().onTokenRefresh(token => {
266+
firebase().messaging().onToken(token => {
267267
saveTokenToDatabase(token);
268268

269269
}

0 commit comments

Comments
 (0)