Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 4096195

Browse files
#92 Google Sign-In
1 parent b21bcf0 commit 4096195

File tree

10 files changed

+310
-61
lines changed

10 files changed

+310
-61
lines changed

CHANGELOG.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
<img src="docs/images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
22

3+
## 3.5.0 (2016, August 9)
4+
5+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.4...3.5.0)
6+
7+
### SDK versions
8+
If version numbers changed clean your platform folders to avoid build errors.
9+
10+
- iOS: 3.3.x
11+
- __Android: 9.4.0__
12+
13+
### New
14+
[#92](#92) Google Sign In, including automatic linking of Facebook-authenticated users in case email addresses match
15+
[#77](#77) Allow users to pass scope for Facebook Authentication
16+
17+
### Fixes
18+
19+
[#94](#94) Fix getDownloadUrl on Android to return string
20+
[#97](#97) Trying to fix toJsObject for Android (Boolean)
21+
22+
323
## 3.4.4 (2016, July 17)
424

525
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.3...3.4.4)
@@ -59,7 +79,7 @@ If version numbers changed clean your platform folders to avoid build errors.
5979
If version numbers changed clean your platform folders to avoid build errors.
6080

6181
- iOS: 3.3.x
62-
- Android: 9.2.0
82+
- __Android: 9.2.0__
6383

6484
### New
6585
- [#43](#43) Storage ([docs](docs/STORAGE.md))
@@ -76,7 +96,7 @@ If version numbers changed clean your platform folders to avoid build errors.
7696
### SDK versions
7797
If version numbers changed clean your platform folders to avoid build errors.
7898

79-
- iOS: 3.2.x
99+
- iOS: __3.2.x__
80100
- Android: 9.0.2
81101

82102
### New
@@ -91,7 +111,7 @@ If version numbers changed clean your platform folders to avoid build errors.
91111
If version numbers changed clean your platform folders to avoid build errors.
92112

93113
- iOS: 3.2.0
94-
- Android: 9.0.2
114+
- Android: __9.0.2__
95115

96116
### New
97117
- [#56](#56) Remote Config ([docs](docs/REMOTECONFIG.md))

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ firebase.init({
116116
```
117117

118118
## Known issues on iOS
119+
120+
#### Authentication failed: invalid_token
119121
On the simulator you may see this message if you have more than one app with the Firebase SDK ever installed:
120122

121123
```
@@ -134,6 +136,10 @@ firebase.init({
134136
}).then()
135137
```
136138

139+
#### Pod dependency error
140+
If you see an error like `Unable to satisfy the following requirements: Firebase (~> 3.3.0) required by Podfile`,
141+
then check [issue 98](#98) which perfectly explains how to update your local Pod spec repo.
142+
137143
## Known issues on Android
138144

139145
#### DexIndexOverflowException
@@ -184,7 +190,7 @@ placing `google-services.json` to `platforms/android/google-services.json` (see
184190
the changes to `build.gradle` which are mentioned above as well.
185191

186192
#### Could not find com.google...
187-
And there's this one: "Could not find com.google.firebase:firebase-auth:9.0.2". That means
193+
And there's this one: "Could not find com.google.firebase:firebase-auth:9.4.0". That means
188194
making sure you have the latest Google Repository bits installed.
189195
Just run `android` from a command prompt and install any pending updates.
190196

docs/AUTHENTICATION.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Version 1.1.0 of this plugin added the capability to log your users in, either
66
* anonymously,
77
* by email and password,
88
* using a custom token,
9-
* using Facebook.
9+
* using Facebook,
10+
* using Google.
1011

1112
Each of these login mechanisms need to be enabled in your Firebase console at the 'Login & Auth' tab.
1213

@@ -188,7 +189,7 @@ Then add the following lines to your code and check for setup instructions for y
188189
```js
189190
firebase.login({
190191
type: firebase.LoginType.FACEBOOK,
191-
scope: ['public_profile', 'email'] // optional: defaults
192+
scope: ['public_profile', 'email'] // optional: defaults to ['public_profile', 'email']
192193
}).then(
193194
function (result) {
194195
JSON.stringify(result);
@@ -231,6 +232,51 @@ For a complete list of the available scope permissions, visit Facebook's documen
231232
4. In your Facebook dev console, go to the Basic settings and add the Android platform if you haven't already. Then set the 'Google Play Packagename' to your applicationId (see your `package.json`) and set 'Classname' to `com.tns.NativeScriptActivity`.
232233
5. Set the Key-Hash as well. If you don't know it you can try Facebook login in your app and observe the `adb logcat` output for something like `Key hash <......> does not match any stored key hashes.`
233234

235+
### Google Sign-In
236+
237+
First, enable Google Sign-In in your firebase instance and add the _Web SDK configuration_.
238+
239+
Then add the following lines to your code and check for setup instructions for your platform below.
240+
241+
```js
242+
firebase.login({
243+
type: firebase.LoginType.GOOGLE
244+
}).then(
245+
function (result) {
246+
JSON.stringify(result);
247+
},
248+
function (errorMessage) {
249+
console.log(errorMessage);
250+
}
251+
)
252+
```
253+
254+
#### iOS
255+
If you want to use it for iOS open the `Podfile` in the plugin's `platforms/ios` folder and uncomment the `GoogleSignIn` line.
256+
257+
Make sure the URL Scheme for `REVERSED_CLIENT_ID` is in `app/App_Resources/iOS/Info.plist`:
258+
259+
```xml
260+
<key>CFBundleURLTypes</key>
261+
<array>
262+
<dict>
263+
<key>CFBundleTypeRole</key>
264+
<string>Editor</string>
265+
<key>CFBundleURLName</key>
266+
<string>REVERSED_CLIENT_ID</string>
267+
<key>CFBundleURLSchemes</key>
268+
<array>
269+
<string>com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b</string>
270+
</array>
271+
</dict>
272+
</array>
273+
```
274+
275+
#### Android
276+
277+
1. Uncomment `google-services-auth` in `node_modules\nativescript-plugin-firebase\platforms\android\include.gradle`
278+
2. Google Sign-In requires an SHA1 fingerprint: see [Authenticating Your Client for details](https://developers.google.com/android/guides/client-auth). If you don't do this you will see the account selection popup, but you won't be able to actually sign in.
279+
234280
### logout
235281
Shouldn't be more complicated than:
236282

firebase-common.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ declare module "nativescript-plugin-firebase" {
2222
* This requires you to setup Facebook Auth in the Firebase console,
2323
* as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
2424
*/
25-
FACEBOOK
25+
FACEBOOK,
26+
/**
27+
* This requires you to setup Google Sign In in the Firebase console,
28+
* as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
29+
*/
30+
GOOGLE
2631
}
2732

2833
/**

firebase-common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ firebase.LoginType = {
44
ANONYMOUS: "anonymous",
55
PASSWORD: "password",
66
CUSTOM: "custom",
7-
FACEBOOK: "facebook"
7+
FACEBOOK: "facebook",
8+
GOOGLE: "google"
89
};
910

1011
firebase.QueryOrderByType = {

0 commit comments

Comments
 (0)