firebase-authentication

Firebase Google sign-in as Users in Authentication

有些话、适合烂在心里 提交于 2021-01-29 14:01:25
问题 I'm developing a Xamarin.Forms app. I've succesfully implemented Google sign-in thanks to the NuGet Plugin.GoogleClient. The problem is when I want to modify the Firebase project rules so only authenticated users can access to the Cloud Firestore database. In my Firebase console appears that the project doesn't have any user: But in the app I'm using my Google account with no problem: How can I authenticate Google signed-in accounts so they can appear in Users, so I can modify the rules of

Flutter: PlatformException thrown by FireBase won't get caught

本秂侑毒 提交于 2021-01-29 13:52:01
问题 I have a function that is used to sign in to Firebase using firebase_auth, however, whenever an exception is thrown it isn't getting caught and still appears in the Android Studio console nor do the print statements in the catch block ever run. How do I fix this? signIn({String email, String password}) { print('listened'); try { FirebaseAuth.instance.signInWithEmailAndPassword( email: email, password: password); } on PlatformException catch (signUpError) { print(signUpError.code); if

In flutter, how can I “merge” Firebase onAuthStateChanged with user.getTokenId() to return a Stream?

為{幸葍}努か 提交于 2021-01-29 13:41:55
问题 In flutter, I'm trying to access Custom Claims to decide which Widget I will show, I was able to get the user as Stream and convert it to a Class doing: Stream<User> get user { return _auth.onAuthStateChanged .map(_userFromFirebaseUser); } User _userFromFirebaseUser(FirebaseUser user) { return user != null ? User(uid: user.uid) : null; } I would like to add the user.getIdToken() claims['role'] to the User object (i.e.: User(uid: user.uid, role: token.claims['role']), but I'm not sure how to

Create a user programatically using Firebase Auth emulator

纵饮孤独 提交于 2021-01-29 10:23:05
问题 I am trying to write jest tests using the Firebase Auth emulator and continue to receive the following CORS error. console.error Error: Headers X-Client-Version forbidden at dispatchError (/Users/me/my-project/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:62:19) at validCORSPreflightHeaders (/Users/me/my-project/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:99:5) at Request.<anonymous> (/Users/me/my-project/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:367:12) at Request

Switching Firebase Auth from Android SDK to Firebase Admin SDK

匆匆过客 提交于 2021-01-29 10:01:57
问题 Currently I have an android app that uses the Firebase Auth for user Authentication. I would like to move the authentication part to the Admin Sdk server, such that The android app makes an http request to the server and the server does the authentication. Unfortunately the the Admin SDK for Java does not have the signInWithEmailAndPassword method. Is there a way to go about this or do I have to include the android sdk on the server also? 回答1: That's not a supported situation with Firebase

How to complete login only after functions.auth.user().onCreate is finished

◇◆丶佛笑我妖孽 提交于 2021-01-29 09:55:42
问题 I'm using firebase functions and I have a function which add new collection when user is creating. The problem is sometimes user is logged in before function is done, so user is logged in but new collection is not created yet (and then I have error message 'Missing or insufficient permissions. because a rule cannot find that collection'). How can I handle it? Is it possible to finish login user (for example using google provider) only when all stuff from export const createCollection =

On authentication triggers I am getting displayName as null

岁酱吖の 提交于 2021-01-29 08:52:07
问题 I want to use users data on authentication trigger. But when I am using them it gives me null. What is wrong with my code? exports.sendWelcomeMessage = functions.auth.user().onCreate((user) => { const name = user.displayName; console.log(name); return null; }) 回答1: I speculate you are creating the user and then setting the display name (eg via 2 calls). onCreate triggers as soon as the user is created, eg createUserWithEmailAndPassword . When you call updateProfile to set the displayName ,

Firebase detect email verification

心不动则不痛 提交于 2021-01-29 08:00:55
问题 When a user verifies their email address, I want to receive some notification on my client app (iOS/Android). I need this to ensure that I can unlock additional capabilities for those users whose address is verified. How can I achieve this? Currently, the only way to do this is to call the reload method on the User object. However, it is not an ideal way of dealing with this situation – after all, I have no idea when they would click on the link. So, performing a reload every time my app

Authenticate user in Share Extension with Firebase

非 Y 不嫁゛ 提交于 2021-01-29 07:29:58
问题 I've been struggling with his for quite some time now.. I have an app and also a Share Extension . Inside the Share Extension the user needs to be authenticated so he can make requests to my Cloud-Firestore (I set up the security rules so only authorized user can access data). However I am not able to authenticate the user inside my Share Extension . I already checked out Firebase Documentation and this SO-Question but that didn't help me. In my case the user can sign in with Email, Google,

FirebaseUI custom layout doesn't show

喜夏-厌秋 提交于 2021-01-29 06:33:45
问题 I have created a custom layout for authentication, but the layout is not shown and Email login screen is displayed instead val customLayout = AuthMethodPickerLayout.Builder(R.layout.custom_signinbasic) .setPhoneButtonId(R.id.buttonPhone) .setEmailButtonId(R.id.buttonEmail) .build() startActivityForResult( AuthUI.getInstance().createSignInIntentBuilder() .setAuthMethodPickerLayout(customLayout) .build(), Signin_Request_Code) Layout <androidx.constraintlayout.widget.ConstraintLayout xmlns