Skip to main content

Web application using OAuth 2.0 framework

This blog post describes implementing a Node js application that uses OAuth 2.0 to upload files in to tyhe google drive. In this project we'll use Google OAuth 2.0 for authentication, Google Drive API as the file uploader and Passport.js as the authentication middleware.

Before we begin, let's see what OAuth 2.0 is.

OAuth 2.0 is the industry-standard protocol for authorization. OAuth 2.0 supersedes the work done on the original OAuth protocol created in 2006. OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices. This specification and its extensions are being developed within the IETF OAuth Working Group.
                                                                                         - OAuth 2.0 Official Documentation

In Simple words, OAuth 2.0 is a authorization framework that allows third party applications to obtain limited access to a HTTP service. The access can be required by various types of clients like mobile applications, web applications etc.

There are four main grant types in OAuth 2.0.


  1. Client Credentials
  2. Authorization Code
  3. Resource Owner Password Credential
  4. Implicit




For this project we'll be using OAuth 2.0 - Authorization Code grant type.

This grant type is widely in use as this type is capable of maintaining the confidentiality of the client while not exposing the code in public. 



Step 1: Authorization Code link

Step 2: User Authorizes application.



Running the application in the local machine

Project source code is available in the GitHub repository: https://github.com/sachiniepa/SecureSoftwareDevelopmentAssignment2.git

Import the project to the local environment
Open the Project with your favourite IDE.
Run 'npm install'
Run 'npm run dev'


Application Flow

On the URL http://localhost:3000 the application displays the button to upload the files. Once the user clicks on the button, the user is redirected to the Google OAuthentication Page. After successful authentication, the user is redirected to the page which allows the user to select the files that should be uploaded.










This is the end of the blog post. Hope you all found it interesting! 

Comments

Popular posts from this blog

NoSQL vs SQL

I am sure most of you all are familiar with SQL database and have worked with MYSQL, Oracle or other SQL databases. And obviousely you must have heard of "NOSQL" as well. So in this blog post we'll see what this NoSQL is and the key differences between NoSQL and SQL. What is "NOSQL"? NOSQL stands for Not Only SQL.It is an approach to database design that can accomodate a wide variety of data models.  NoSQL doesn't have a predefined schema and used for big data and real time web applications. There are several types of database types. 1.Key-Value : Stores data as key value pairs      Ex: Redis, Riak, Memcached 2.Document : Stores data as documents (JSON,BSON,XML)        Ex: MongoDB 3.Column : Stores data in column families as rows have many columns assosiated with.      Ex: Cassendra 4.Graph : Stores entities(nodes) and relationships(edges) between them and represent it in a graph.      Ex: Neo4j Benefits   of NoSQL Basicall

Getting started with React js

In this blog post, I'm gonna explain you all about React js, a javascript technology that is used to create interactive single page applications.

New features of Java 10

Hello all! In this blog post I am gonna tell you about the new features of java 10.I am pretty sure all of you have heard of Java 10! Well, some of you might have dive in to Java 10 as well. Noo? Then this blog post will be a good beginning for you to learn about java 10 and its new exciting features. I am not gonna tell you about all the features but I will be focusing on the features that I found more interesting. 1.Local Variable Type Inference  Java 10 onwards Java also will have the 'var' keyword like JavaScript. This allows you to specify a variable without mentioning the data type of that particular variable but Java compiler will identify the real data type of the variable you declared.And also note that this 'var' keyword can only be used when defining variables inside methods and variables inside blocks.Although Java 10 allows the users to define variables with 'var', that doesn't make Java a dynamically typed language because once the ty