‫Instructor: Hi. Within this lecture
‫we are going to test to see if our application works.
‫But before we do that,
‫we need to do some final configuration
‫on the Firebase dashboard.
‫So make sure you open your Firebase dashboard, okay?
‫And if you closed it for a reason,
‫you can reach it through firebase.google.com.
‫And we need to enable the database and authentication first.
‫If we had used storage in our application,
‫we would've enabled it as well,
‫but right now we are not using it,
‫we are only going to enable database and authentication,
‫and this is one time only.
‫If you do that for an application, then it's done.
‫Just click on the authentication
‫and come over here to set up sign in method.
‫So there are a couple of sign in methods
‫like Google, Facebook, Twitter,
‫but if you remember we're using email and password
‫in order to create users and in order to log them in.
‫So what we are gonna do,
‫we are going to enable email and password.
‫So make sure you click on it
‫and just hit this enable button.
‫We're not enabling the email link.
‫We're only enabling the username and password.
‫Okay?
‫So after you click save, it's done.
‫Now you enabled authentication.
‫Now let's move to database, which is very important.
‫So over here we are going to choose Cloud Firestore.
‫Actually, there are two databases in Firebase right now,
‫one of which is Cloud Firestore,
‫and the other one is Realtime Database.
‫So Realtime database is the older version.
‫We're going to go with the latest technology,
‫and the newer technology, which is Cloud Firestore.
‫And as you can see, it's realtime as well.
‫So it has much more powerful queries,
‫much more powerful operations,
‫when we compare to the real time database.
‫So that's why we are using Cloud Firestore.
‫So I'm going to say create database.
‫And over here we get two options,
‫which is production mode and test mode.
‫So in the production mode,
‫we don't get to see the database and write the database.
‫So in test mode, we can read the database
‫and write to database as well.
‫So most of the time, like 99% of the time,
‫developers will go with the test mode because they want
‫to test the database, they want to write datas in it,
‫and they want to read those datas,
‫so we're gonna do that as well.
‫We're going to continue with test mode,
‫but the problem is they don't configure this properly
‫after their application is done, most of the time.
‫So that's what we are going to work on, okay?
‫We're going to actually start in test mode,
‫and we're going to see what happens if we leave it as it is.
‫And then we're going to see how to fix this problem as well.
‫Now I'm going to say start in test mode.
‫So this is important, make sure
‫you choose the test mode over here and click next.
‫And then you have to choose a location for your server.
‫So this is physical computer location, Okay?
‫So what we do over here is to generally
‫choose the country that we are targeting.
‫For example, if you're in Europe, go for Europe.
‫If you're in USA, go for USA.
‫If you're in Asia, go for Asia.
‫It really doesn't matter what you choose,
‫it will work anyhow.
‫But if you choose something closer to your country,
‫then it might perform a little bit faster,
‫like maybe less than a second, okay?
‫And if you're targeting whole world in your app,
‫just choose somewhere in between, like Europe.
‫And the important thing over here is that
‫once you choose it, you cannot change it.
‫So I'm going to, I chose Europe, as you can see right now,
‫and I have clicked on done,
‫and I'm not going to be able to change it afterwards.
‫And again, it will work as fine,
‫even if I'm in United States,
‫it will still work, but it's always logical
‫to choose one that is near to my target country.
‫So let me open the Android Studio over here.
‫And what we gonna do, we are going to run this application.
‫And then after the Firestore setup is done,
‫we are going to test to see if everything works as expected.
‫Please make sure before you do that,
‫please make sure before you type in
‫your email and password to sign up,
‫wait until the Firestore setup is completed.
‫It may take a little bit of time,
‫like one and a half minute maybe,
‫maybe two or three minutes,
‫but it will be done eventually.
‫And even though you see the screen,
‫make sure you wait until it's done.
‫So I'm gonna do that.
‫I'm going to wait until my Firestore is done,
‫and I'm gonna check to see if it's completed right now.
‫Yep, it seems that it's completed,
‫and it took me to this database.
‫So this is our database, okay?
‫This is Firestore database in Firebase.
‫So how does this work?
‫I'm going to show you, it's actually
‫a little bit different than SQL or ESQL.
‫So if you're used to SQL, just try to forget it.
‫It's not structured like SQL, it's a little bit different.
‫I'm going to show you how it works.
‫So let me just sign in with james@metallica.com.
‫And for password, I'm just gonna write 123456.
‫And I'm going to say sign in,
‫but it doesn't make sense to say sign in
‫because I don't have any account right now.
‫As you can see, when I say sign in,
‫it says that there is no user record like that.
‫So what I'm going to do, I'm going to hit on sign up,
‫and it will sign me up, it will register my app.
‫And as you can see,
‫it actually took me to the feed,
‫feed weave controller, feed activity, I mean.
‫And over here in the authentication,
‫if you come to this section,
‫you can see james@metallica.com is actually
‫registered right now in the authentication module.
‫We get to see its created date, sign in date,
‫email, password is not shown for security reasons.
‫And if I sign out right now,
‫I can create another email and other account,
‫but I'm gonna go for adding a tweet.
‫And over here I'm going to say something
‫like tweet tweet test, and some gibberish things, like that.
‫And I'm going to say tweet,
‫and it will upload it to the Firestore,
‫and we get to see the result like this.
‫So if I go to database,
‫then I will see the the structure of my database.
‫So as you can see, my tweets are actually stored over here.
‫So we get to see the date,
‫we get to see the tweet itself, and the user email.
‫So, I believe there some kind of a bug over here.
‫It shows like two times, it's not very important.
‫We can fix it.
‫And let me try this one more time.
‫If everything shows like a duplicate value,
‫then it should be a real problem.
‫Nope, I believe it was a temporary bug.
‫Now we see the actual result over here.
‫So let me try one more time to just make sure of it.
‫Okay.
‫And here you go.
‫Yeah, it works.
‫So as you can see, we have a tweet collection,
‫and we have different documents under that collection.
‫Whenever I add a tweet, it will add over here.
‫So let me create another user like lars@metallica.com,
‫and come over here to give some password and sign it up.
‫And as you can see, even though I'm actually
‫signed in with Lars, I can still see the James tweets.
‫Now let me add a tweet with Lars and see if it shows up.
‫Yeah, here we go.
‫It shows up over here.
‫Now we get to see the Lars and James tweets
‫and we can add as many as we want,
‫like Lars Lars Lars, and say tweet.
‫Yep, it works.
‫Now we are certain that it works.
‫So just add couple of tweets over here
‫just to have some database,
‫like some stuff on our database, right?
‫Because we are going to see if our database works or not,
‫and if our database actually has
‫some vulnerabilities or not.
‫So I'm going to fill this up a little bit
‫with gibberish things, like that.
‫And as you can see, we get to scroll down
‫once the screen reaches its limits like this
‫because it's a recycler view.
‫So that's a recycler view.
‫We use a recycler row in order to display the data
‫that we are populating from Firestore,
‫and it goes as long as we need it.
‫So as you can see, our tweets are stored
‫in the collection of tweets under individual documents.
‫And over here now we have a fully working app.
‫Okay?
‫So if you see an app,
‫and if you get suspicious that it works with Firebase.
‫So, there are a couple of steps to be done
‫in order to make sure it works with Firebase.
‫And then later on, you are gonna have
‫to find the Firebase id of that app,
‫which we are going to see how it's done.
‫And then later we are going to see if it has some kind
‫of misconfiguration regarding to Firestore security rules,
‫or database security rules in general.
‫And then we are going to see
‫if we can exploit this vulnerability or not.
‫We're going to use a lot of different methods
‫in order to get this datas, get this information.
‫We're going to use reverse engineering
‫as well as network listening in this section.
‫So if you can get the information with reverse engineering,
‫then it's great, but if you cannot get it,
‫I'm going to show you some alternative ways
‫in order to obtain that information.
‫And with these alternative ways, actually,
‫you can do much more If you're working
‫with another database structure or another backend service,
‫you can still use what I'm about to teach you.
‫So that's what we are going to do within this section.
‫And also we are going to talk about certificates.
‫We are going to talk about SSL, we're going to
‫talk about network sniffing, and every stuff
‫that you can think of to hack into this database,
‫and get the data and delete the data,
‫and then fix it as well.
‫So if you have come to that point,
‫then it's great you have a working app.
‫Now it's time to stop and continue within the next lecture.