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

Commit

Permalink
Added Google Access Token (Android) #880
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Aug 28, 2018
1 parent 5e90e9a commit 77ab04b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
},
"dependencies": {
"nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-6.5.0.tgz",
"nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-6.6.0.tgz",
"nativescript-theme-core": "^1.0.4",
"nativescript-unit-test-runner": "^0.3.4",
"tns-core-modules": "~4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/AUTHENTICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ Then add the following lines to your code and check for setup instructions for y
);
```

#### Google Access Token (Android only, iOS Coming soon)
#### Google Access Token
Upon successful authentication, Google creates an access token that can be obtained from the login method's result object. This access token can then be used for Google API:

```js
Expand Down
3 changes: 1 addition & 2 deletions src/firebase.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,7 @@ function toLoginResult(user, additionalUserInfo?): User {
providers.push({id: pid, token: firebase._facebookAccessToken});
} else if (pid === 'google.com') {
providers.push({id: pid, token: firebase._googleSignInIdToken});
}
else {
} else {
providers.push({id: pid});
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/firebase.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,8 @@ function toLoginResult(user, additionalUserInfo?: FIRAdditionalUserInfo): User {
if (pid === 'facebook.com' && typeof(FBSDKAccessToken) !== "undefined") { // FIRFacebookAuthProviderID
const fbCurrentAccessToken = FBSDKAccessToken.currentAccessToken();
providers.push({id: pid, token: fbCurrentAccessToken ? fbCurrentAccessToken.tokenString : null});
} else if (pid === 'google.com' && typeof(GIDAuthentication) !== "undefined") {
providers.push({id: pid, token: firebase._gIDAuthentication ? (<GIDAuthentication>firebase._gIDAuthentication).accessToken : null});
} else {
providers.push({id: pid});
}
Expand Down

0 comments on commit 77ab04b

Please sign in to comment.