Posts

JWT Token Auth | JSON Web Tokens in Node.JS

Image
When you create a REST service or any backend server for a website or an app, there is one talk about this new trending method for authenticating the user who is requesting your servers for data.   Previously there were only a few ways to know where is the request coming from. That could be storing  cookies, sessions in browsers, and using them to identify the user. So this method evolved, the trick is to create a string that has info of the user and data about the user.   So JWT has payload, header, and signature which has info of the user and other important data. Why JSON you ask? because JSON is less verbose than XML and when encoded the size is small to easily use in HTTP transmissions. The authorization token is passed as:   Authorization: Bearer <token> How it works? User signs in with username and password.  The server creates a JWT using one of the algorithms (HMAC, RSA, or ECDSA). Then this token is sen...

Should I read a BOOK or take a COURSE?

There are lots of confusion these days as we have more options to pick from. As we grow we tend to look at answers to the problem all by ourselves. Considering Computer Science, we have a huge list of domains available like Machine Learning, Artificial Intelligence, Mobile apps, Web apps, Computer Network and Security, Data mining, Data Science, etc. and whatnot.  The first problem comes which domain to choose from, that is done, how do I learn it? So should I read a book or take a course (online or offline). Even if you choose one from book or course, still loads of options from a book list and course sites and types.🤔 One solution to this problem is: 🤗   Learn by doing. Simple, what am I saying is pick a domain, pick a project under the domain (a simple one, old one or just something of your own), and start developing it from scratch. Now you'll say I don't know anything about the subject, how am I going to code? So use the internet, check source codes of open source proje...

Adding Firebase functionality in your app | Part 2 Creating Firebase Authentication

Introduction: In this post, we will create a Login and Registration Page with Firebase authentication, we will accept the name, email, password of the user and register the user with the Firebase auth library. Implementation: First, we need to enable authentication for our project, go to the Firebase console, select Authentication from the left panel and then sign-in method, enable email method. In AS, go-to the assistant, in the right panel, select Authentication, click connect to Firebase, it will be in green when connected, second select Add Authentication to the project, Accept changes and finish. Now you can start coding. Create an Empty Activity, named as SignUp Go to SignUp.xml and add the following XML. The XML file defines three EditText for user input and Button. Add the following java code to read the input and create an account with the Firebase If everything is done correctly, you would be able to create an account with your email, when created check...

Adding Firebase functionality in your app | Part 1 Connection

Image
Introduction :   Firebase is an online free cloud database, storage and authentication provider by Google. It can be used in mobile apps, websites, and other standalone. It provides database storage facility which is real-time, means the changes made to the database are reflected in user apps in realtime. It is suitable for personal as well as business applications. Anyone with a Google account can start working with the Firebase. I am going to post a series of articles on Firebase, so stay tuned. Connecting your Android project with Firebase : There are few ways to connect to Firebase, but I'll show a quick and easiest way which is not really documented on Google Docs. Create an Android Project with Android Studio. Sign In with Google in AS with the same account that you want the Firebase project to be with. You can log in in AS with the option in the top-right corner, then go to tools option in the options menu. Choose firebase and then the assistant will pop up fro...

Create an APK of Android Projects from Android Studio

Image
Introduction : Creating an Android app is quite simple when you get a hold of it, but sometimes deploying it can get tricky, especially while the project is going to target some particular android users. So here's a walkthrough. Steps : Code cleanup, remove unused resources, removing these would make your apk as small as possible. String resources, extract strings that are hardcoded, these string won't be translated if the system is using some other language. Add appropriate android api in app.gradle file. Make sure everything is working fine and that there no extra debugging details available on the UI.  Once you're ready : Click on the Build option in the Options on the Top. Select Generate Signed APK Create Key for app, make sure you keep the key file safe, because when updating the file you might need this file again. Set a password and key store path Finish the process You will get a message showing the completion ...

Display a table in JFrame UI from MySQL Table

Introduction :    Many times while creating UI you come across difficulties like, how to display data to the user which is readable and looks good. Mostly labels are used to display text but for dynamic data, there's no good way to show them. So, here is the way to display data in a table directly from the MySQL table on the UI using JTable and some tricks to read data from ResulSet object, the output from the MySQL database. Implementation : The following code should be added in the frame initialization methods. Explanation : Firstly creating the data structures to store the data values and the column names. Looping through the ResultSet object and reading the data. Looping through the ResultSetMetaData object, which returns the names of the table which we will use as column names. Adding the JTable to JScrollPane, to make the Table scrollable. Source : I have a project on GitHub that implements such codes. It is a project of the Library Manag...

What are Google Play Instant Apps

Native Android apps, without the installation With Google Play Instant, people can tap to try an app or game without installing it first. Increase engagement with your Android app and gain more installs by surfacing your instant app across the Play Store, Google Search, social networks, and anywhere you share a link. Android’s new app publishing format, the Android App Bundle, makes it easier than ever to offer a Google Play Instant experience. Starting from the Android Studio 3.3 beta release, you can build and publish one app bundle artifact to Google Play containing both instant and dynamic feature modules. Build instant games easily with Cocos and Unity plug-ins. Google Play Instant is open to all app and game developers. These apps will give the experience to use it and test it on the device without the need to download the whole app. This method is suitable with games because the user first wants to know whet...