firebase-authentication

firebase (fcm) says 401 unauthorized

守給你的承諾、 提交于 2019-12-04 06:14:55
private void sendMsg() { DBManager dbManager = DBManager.getInstance(); ArrayList<String> firebaseIds; try { ResultSet rs= dbManager.getRegisteredFirebaseDevice(); while(rs.next()){ System.out.println(rs.getString(1)); firebaseIds.add(rs.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } String url = "https://fcm.googleapis.com/fcm/send"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); // add reuqest header con.setRequestMethod("POST"); con.setRequestProperty("Authorization: key", "AIzaSyAl6S936qt_NKKFwwbd-NEmiSGIL7G_yJc"); con

Xcode Firebase | Cannot convert value of type'AuthDataResult' to expected argument type 'User'

北战南征 提交于 2019-12-04 06:14:22
问题 I tried literally tried every possible option to write it, but I can't seem to figure out the solution. func signup(email: String, password: String) { Auth.auth().createUser(withEmail: emailText.text!, password: passwordText.text!, completion: { (user, error) in if error != nil { print(error!) }else { self.createProfile(user!) //Here's the problem described in the title // let homePVC = RootPageViewController() self.present(homePVC, animated: true, completion: nil) } }) } func createProfile(_

Type “user?” had no member UID (Swift 3, Firebase)

无人久伴 提交于 2019-12-04 06:11:41
问题 I am setting up a login page with Firebase and I've run into an error where uid isn't getting recognized. Here's my code: FIRAuth.auth()?.createUser(withEmail: email, password: password, completion: { (FIRUser,error) in if error != nil { print(error) return } guard let uid = user?.uid else { return } I also can't command-click into FIRUser , however if I get rid of the guard statement, authentication works perfectly fine. I have Firebase and FirebaseDatabase imported (can't import

Firebase rule auth.token.email is not working: “Simulated write denied”

六眼飞鱼酱① 提交于 2019-12-04 06:10:30
问题 https://firebase.google.com/docs/reference/security/database/#authtokenF { "rules": { "c":{ ".write":"newData.child('email').val()=== auth.token.email" }, } } Always it showing "Simulated write denied" How to solve this problem ? Is there any mistake with my firebase rule 回答1: It looks like you're not providing an email address in the authentication data. When you select a provider, the simulator shows the exact auth.token payload that it will use. For the Google provider my Auth token

FirebaseAuth signInWithEmailAndPassword() in v11.4.2 not responding

两盒软妹~` 提交于 2019-12-04 06:08:49
问题 I have upgraded to Firebase Android libraries v11.4.2 to try out Firestore on my Android app. However, when I try to use FirebaseAuth to login with signInWithEmailAndPassword(), my app just hangs. I have confirmed with the debugger that the signInWithEmailAndPassword() call is made, but the callback is never called. I have also reverted back to v11.0.2 with no other code changes and it works as expected. Has anyone else had this problem and how did you fix it? Thanx in advance. 回答1: I figured

After uninstall app creating new user insted of get userID from Firebase

北慕城南 提交于 2019-12-04 05:51:54
问题 I have app which during lunch create anonymous user ID, but after UN-install my app create new user with new ID. How can I get userID which was before UN-install ? My code to anonymous login: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mAuth = FirebaseAuth.getInstance(); if(mAuth.getCurrentUser() == null){

Firebase 3.0 session persistance

試著忘記壹切 提交于 2019-12-04 05:50:22
It seems impossible to use session persistence in firebase 3.0. This was possible in the previous version: https://www.firebase.com/docs/web/guide/login/password.html authWithPassword() takes an optional third parameter which is an object containing any of the following settings: remember - String If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end

getting value from firebase database by authentication

纵然是瞬间 提交于 2019-12-04 05:48:21
问题 My android app has a string ,and i want to send it to the Firebase database for authentication.If that string matches "jhgkjgl",i want Firebase to send me the data ,otherwise not send anything. What do i have to write both in my java and firebase console? What do i need to do? rules: { "rules":{ ".read":"auth.uid.matches(/jhgkjgl/)" } } The data i want to get in my app : q:"qqqweryty" My path is: https://fir-rial-8888.firebaseio.com/ I just want to use the string for authentication.If the

Proper way to maintain unique usernames and extra profile data in Firebase

扶醉桌前 提交于 2019-12-04 05:29:15
问题 I am trying to create a separate datastore for unique usernames and extra profile data such as avatar etc. I have the following schema: mydatabase : { users: [{ <actual user's id>: { username: "helloworld" }, <actual user's id>: { username: "2test" }] } Is my approach correct on this? I didn't see a way in firebase to store usernames or extra user data in the Authentication records of firebase. Also I noticed most examples I find online generate a push key for each row of data, but here I am

firebase phone authentication not working after .apk released in play store even after I have updated sha1 in firebase console

萝らか妹 提交于 2019-12-04 05:24:16
Firebase phone authentication not working after .apk released in play store even after I have updated sha1 in firebase console after that I have generated google- services.json again and updated json file in android studio project. There was many other sha1 was also present in firebase console project setting should I delete them before generating new google-services.json When you upload an apk to the play store then play store creates a new certificates called "App signing certificate". This will contain the SHA1 certificate that you require. It can be found at: Released Management->App