React and Google OAuth with .NET Core backend

Atul Shukla
Oct 22, 2018 · 5 min read
Image for post
Image for post
“grayscale photography of two children sitting on ledge” by Joshua Clay on Unsplash


I was inspired to write this article because we rarely find React or Angular posts with .NET Core backend as examples, and I am sure, like me, there are several developers using this combination tech stack for their products.


If you wish to skip the post and get to the code, you can access it here (updated to .NET Core 3.1)


As mentioned in the post by Google, the following is the application flow we will be working towards:

Image for post
Image for post
Google Sign-in for server-side apps

Setup Google Developer Console

The first step is to setup API access for Google for you app (if you haven’t already done so). The steps are straightforward and documented in several posts. I like what @alexanderleon has posted in this article and I will simply provide a link to it.

Setup .NET Core Webapi backend

I am assuming that you have some experience with .NET Core WebApi. There are several tutorials out there, but you can get started here.

  • Step 2: Run command to create a new .NET Core WebApi project
$ dotnet new webapi
$ dotnet add package Google.Apis.Auth
$ dotnet add package Newtonsoft.Json
$ dotnet add package Serilog
$ dotnet add package Serilog.Sinks.Console

Setup React frontend with Redux and React-Router

The frontend is created using the create-react-app tool.

$ create-react-app frontend && cd frontend
$ npm install react-google-login react-redux react-router-dom redux redux-logger redux-thunk jsonwebtoken
$ cd src
$ mkdir actions components containers reducers services


Thoughts on code, architecture and other fun stuff

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store