Comments (15)
@robingenz I hope exams are going well. What is the estimated lead time on resolving this?
from capacitor-firebase.
Hi @ssibrahimbas,
thank you for your request.
This ID is IDP-specific user data and does not have to be present. According to Firebase Docs the type on Android of getProfile()
is abstract Map<String, Object>
.
For that reason I wouldn't focus on the ID but instead try to make the whole map available.
The ID would then be contained there.
This would definitely be a useful feature.
from capacitor-firebase.
I'd like to add my own interest in being able to retrieve AdditionalUserInfo.
My use case is to determine whether someone that has logged in is a new user or not (by checking isNewUser).
This would be useful for several reasons, but the first thing that came to mind was triggering an appropriate analytics event (sign_up vs login).
Just taking the web implementation of this plugin for a google sign-in as an example, the signInWithPopup result is not exposed for us to use (which resolves with the required UserCredential).
Following your example for using the JS SDK here is too late since the signInWithCredential (which resolves with the required UserCredential
) is technically a second login and thus will always return false for isNewUser
.
from capacitor-firebase.
Is there any update on this feature?
This has become a problem for Apple login now as Apple is refusing apps that don't make use of the fullName data they provide to us, to pre-fill in user fields.
Issue is that Apple doesn't return the users name in the idToken, instead it's available through the appleIDCredential.fullName field (only given the first time the user authorises your app).
If we could expose AddtionalUserInfo (on iOS & Android), then this name field could be passed back to the web view to update the user instance there.
Refer to this issue for full reference to the issue (still ongoing):
firebase/firebase-ios-sdk#4393
from capacitor-firebase.
Is there any update on this feature?
This has become a problem for Apple login now as Apple is refusing apps that don't make use of the fullName data they provide to us, to pre-fill in user fields.
Issue is that Apple doesn't return the users name in the idToken, instead it's available through the appleIDCredential.fullName field (only given the first time the user authorises your app).
If we could expose AddtionalUserInfo (on iOS & Android), then this name field could be passed back to the web view to update the user instance there.
Refer to this issue for full reference to the issue (still ongoing): firebase/firebase-ios-sdk#4393
@ssibrahimbas currently working on that (see #81).
However, you should already have access to the name of the user (see displayName
in https://github.com/robingenz/capacitor-firebase/tree/main/packages/authentication#user).
from capacitor-firebase.
Is there any update on this feature?
This has become a problem for Apple login now as Apple is refusing apps that don't make use of the fullName data they provide to us, to pre-fill in user fields.
Issue is that Apple doesn't return the users name in the idToken, instead it's available through the appleIDCredential.fullName field (only given the first time the user authorises your app).
If we could expose AddtionalUserInfo (on iOS & Android), then this name field could be passed back to the web view to update the user instance there.
Refer to this issue for full reference to the issue (still ongoing): firebase/firebase-ios-sdk#4393@ssibrahimbas currently working on that (see #81).
However, you should already have access to the name of the user (see
displayName
in https://github.com/robingenz/capacitor-firebase/tree/main/packages/authentication#user).
The User
object with displayName
doesn't come through as we are skipping native auth (you have to for Apple sign in anyway). As per the Github issue I mentioned, Firebase is not saving the displayName
either way.
from capacitor-firebase.
you have to for Apple sign in anyway
What du you mean exactly? You do not have to set skipNativeAuth
to true
to use Apple Sign-In.
from capacitor-firebase.
you have to for Apple sign in anyway
What du you mean exactly? You do not have to set
skipNativeAuth
totrue
to use Apple Sign-In.
Sorry I should have elaborated further, technically it's not a requirement. What I meant to say is if you want to sign in on the web view, you need to have skipNativeAuth
to false
, otherwise the web sign in fails as the nonce has already been used.
from capacitor-firebase.
Okay, now I understand the problem. I prioritize the issue.
from capacitor-firebase.
@robingenz any update on this one?
from capacitor-firebase.
No, not yet. I will try to look into this issue next week. I am currently writing my exams and therefore do not have much time.
from capacitor-firebase.
Thank you for the update. Good luck with your exams!
from capacitor-firebase.
For reference I have added the code for the main function that I had to modify for the Apple auth. I'm not a Swift developer so please excuse any bad code.
It's important to note that Apple will only give the name on the very first attempt of that user authorising your app, any subsequent requests do not include the name field. If you need to test this I recommend visiting https://appleid.apple.com/ after each sign in, you can deauthorise your application there for a fresh sign in attempt.
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
guard let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential else {
return
}
guard let nonce = currentNonce else {
fatalError("Invalid state: A login callback was received, but no login request was sent.")
}
guard let appleIDToken = appleIDCredential.identityToken else {
print("Unable to fetch identity token")
return
}
guard let idTokenString = String(data: appleIDToken, encoding: .utf8) else {
print("Unable to serialize token string from data: \(appleIDToken.debugDescription)")
return
}
var displayName: String?
if let fullName = appleIDCredential.fullName {
if let givenName = fullName.givenName, let familyName = fullName.familyName {
displayName = "\(givenName) \(familyName)"
}
}
let credential = OAuthProvider.credential(withProviderID: "apple.com", idToken: idTokenString, rawNonce: nonce)
self.pluginImplementation.handleSuccessfulSignIn(credential: credential, idToken: idTokenString, nonce: nonce, accessToken: nil, additionalUserInfo: displayName)
}
from capacitor-firebase.
ETA is 2 weeks, I am unfortunately still busy, PRs are welcome
from capacitor-firebase.
You can now test the first dev version:
npm i @capacitor-firebase/[email protected]
Example to get the Google user ID (Android):
const result = await FirebaseAuthentication.signInWithGoogle();
const googleUserId = result?.additionalUserInfo?.profile?.sub;
@typefox09 Unfortunately your problem had nothing to do with AdditionalUserInfo
, because the Apple DisplayName is not part of this interface (see Firebase docs). So for your problem I would like to try to find another solution first, before we extend interfaces with custom properties. I have created a new issue for this: #155
from capacitor-firebase.
Related Issues (20)
- "prompt-with-rationale" not showing on iOS HOT 2
- feat(performance): add missing methods (e. g. `setAttribute(...)`, `getAttribute(...)`) HOT 4
- feat(storage): add file metadata during upload HOT 3
- fix(firestore): update `data` property type in `QueryDocumentSnapshot`
- bug: Topic operation failed: INTERNAL_SERVER_ERROR. Will retry Topic operation. HOT 1
- feat(analytics): add `setConsent` method
- bug(authentication): verifyPhoneNumber errors are ignored on iOS HOT 2
- ⚡ Capacitor 6
- bug: Firestore fails an iOS app, while on the the web it works good HOT 9
- bug(authentication): No user is signed in HOT 3
- Support dynamic firebase config HOT 1
- bug: HOT 1
- bug: R8 Missing Class HOT 3
- bug: firebase collections not returning timestamps on ios HOT 1
- bug: Collection Groups Don't Work HOT 3
- Authentication issue to use MS auth directly with firebase HOT 2
- Appcheck Package - getting invalid token with short length HOT 2
- bug: Can't deleteUser() due to auth/requires-recent-login HOT 4
- bug: Does not return collection data when more than one query constraint HOT 5
- Google login is not working HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capacitor-firebase.