Skip to main content

Posts

Introduction On PostgreSQL Database Using Docker

PostgreSQL is a free open-source relational database management system. In this article, we will learn basic steps to run the PostgreSQL Docker image. Install And Setup Docker: Step1: Download docker into our local system "https://docs.docker.com/desktop/" . Docker was available for all desktop operating systems. Step2: After downloading the docker installer, then install it. Now to run any docker containers(eg: Redis, MongoDB, PostgreSQL, etc) this docker instance we just installed should be active(should be running). Postgres Docker Image: We have to download or pull the Postgres docker image into our local system by running the below command. docker pull postgres Run Postgres Docker Container: After downloading the Postgres image, need to start the container by running the below command. docker run --name mypostgres -e POSTGRES_PASSWORD=secret -p 5432:5432 -d postgres --name flag to specify the name of our container. -e flag to specify an environmental variabl

GraphQL Subscriptions In Angular Using Apollo Angular Library

In this article, we are going to understand GraphQL Subscriptions in an angular application using the Apollo Angular Library. Graphql Subscription: GraphQL subscriptions are a way to push data from the server to the clients that listen to real-time messages or payload or data from the server. Subscriptions are similar to queries in that they specify a set of fields to be delivered to the client, but instead of immediately returning a single response, a result is sent every time a particular event happens on the server. So for this demo, I have created a GraphQL endpoint in .Net5. So I'm going to use that as my server. Publisher: Subscriber: So above 2 images like 'Publisher' and 'Subscriber' are tested using the browser. Now we will implement those publisher and subscriber functionalities into the angular application. Create An Angular Application: Let's begin our demo by creating an angular sample application. Command To Install Angular CLI:(If not insta

A Demo On HotChocolate GraphQL Subscriptions(Pub/Sub) Using Application InMemory Storage

This article will implement a small demo on subscriptions in Hot Chocolate Graphql using the application In-Memory storage. Since our target storage is application In-Memory, so this approach only apt for a single server hosted application. For applications with multiple servers then we have to use Redis Store. GraphQL Subscription Flow: In general, events raising or publishing will be triggered from the GraphQL mutation resolvers. Inside mutation resolvers raise the event to store the data into application in-memory storage. In GraphQL 'Subscriptions' is one of the root definitions like 'Query', Mutation'. So the subscription resolvers will always receive the data from in-memory storage. So the subscription resolvers can also be called subscribers whose job always watches the data send by the raised events. So the event raised from the mutation resolver will be received by all subscribers. Create A .Net5 Web API App: Now let's begin our journey by creat

Part-2 VueJS JWT Auth Cookie - Refresh Token Usage

Part-1  we implemented user login and logout using the HttpOnly Jwt cookie in our Vue application. In this article, we are going to understand the refresh token(refresh token also stored in HttpOnly Jwt Cookie). Gaurd Routes: One of the important cases we always need to consider while implementing authentication is guard routes between user authenticated and non authenticates cases. Suppose an authenticated user can't access the login page. Similarly, a non-authenticated user can't access the dashboard page(any page that needs user authentication). So to fix this kind of case we have to define our navigation rules at our route guard. But before implementing our route guard logic, we need to set one flag in browser local storage. The flag we will add represents that the user is authenticated. This flag helps us to avoid unnecessary calls to the profile API if the user reloads the application. Now let's add the flag to browser local storage on user authenticated. So let&#

Part-1 VueJS JWT Auth Cookie - Access Token Usage

In this article, we will implement Vue3 application authentication with the JWT auth cookie. So in this portion, we mainly target access token utilization. To know about Jwt authentication in vuejs like managing token using browser storage then check below mentioned articles. Part-1 Jwt Access Token Auth In Vue3 Part2 Refresh Token In Vue3 HTTP Only JWT Cookie: The HTTP only cookie is only accessible by the server application. Client apps like javascript-based apps can't access the HTTP-only cookie. So if we use authentication with HTTP only JWT cookie then we no need to implement custom logic like adding authorization header or storing token data, etc at our client application. Because once the user authenticated, that auth cookie will be automatically sent to the server by the browser on every API call. Authentication API: To implement JWT cookie authentication we need to set up an API. For that, I had created a mock authentication API(Using the NestJS Server framework). So d

Part-3 Steps To Implement Google Authentication Into Existing Blazor WebAssembly Standalone Application

In this article, we will understand steps to integrate google authentication from scratch manually into the Blazor WebAssembly standalone application.  Part-1  google authentication steps by default bundled with blazor webassembly application on selecting the authentication checkbox while creating the project. But here we will inject the authentication into the project that is not previously enabled with authentication. Create Blazor WebAssembly Project: Let's create a Blazor WebAssembly project without checking the authentication. Install Authentication NuGet: Package Manager: Install-Package Microsoft.AspNetCore.Components.WebAssembly.Authentication -Version 5.0.5 .Net CLI: dotnet add package Microsoft.AspNetCore.Components.WebAssembly.Authentication --version 5.0.5 Register Blazor Application In Google API's Console: Step1:  Create an account in Google API's Console(https://console.cloud.google.com/apis/dashboard). Step2: Select the 'Credentials' menu and