New to site?


Lost password? (X)

Already have an account?


(X)

Presents

#CSHARPCON20

The C# Corner Annual Conference 2020 is a three-day annual event for software professionals and developers.

3
DAYS
72
SPEAKERS
65
SESSIONS

Magnus Mårtensson
Microsoft Regional Director, Azure MVP, CEO Loftysoft

Avirag Jain
Director & CTO R Systems

Mahesh Chand
Founder C# Corner, CEO Mindcracker

Chris Gali
CEO & Co-Founder Graphite

Subinder Khurana
Chief Architect StoryProcess, Founder NASSCOM DeepTech Club

Bryan Rishforth
Investor, Chairman Graphite

Bryn Everson
Director Biz Dev Graphite

Raj Tiwari
Digital Transformation Leader, Futurist and Visionary

Joseph Guadagno
Microsoft MVP, Lead Quicken Loans

Nikita Sachdev
Entrepreneur, Blockchain Enthusiast & Advisor, Social Media Influencer

Doug Wagner
COO & Founder Adapt Technical Group

Ritesh Modi
Architect, Senior Evangelist, Cloud Architect

Crystal Wenrick
Director Communications Mindcracker

Allen O’Neill
Microsoft MVP, Consulting Engineer/Architect

Praveen Kumar
CEO MCN Solutions

Chris Love
Founder Love2Dev, Microsoft MVP, Author

Sanjay Vyas
Microsoft Regional Director, Microsoft MVP, Founder & CEO SkillLabs Technologies

Veena Sarda
Deep Learning Consultant, Author

Sekhar Srinivasan
C# Corner MVP, Microsoft Certified Trainer, Pluralsight Author

Lalit Bansal
Founder & CEO - EIY SYS

Navdeep Garg
CEO Revinfotech

Prakash Tripathi
Tech Manager/Leader, Microsoft MVP, Blogger

Bhavna Jain
Breakthrough Consultant

Naveen Sharma
Enterprise Architect, Leadership Coach, Author

Vidya Vrat Agarwal
Principal Architect, Microsoft MVP, Author

Sheetal Agarwal
Founder Clownselors, Medical Clown, Trainer

Abhishek Kant
Founder GTM Catalyst

Vishnu Saran
Founder & CEO VoiceQube

Sandeep Soni
Founder & CEO Deccansoft, Microsoft Certified Trainer

Parveen Malik
AVP InfoSec & Vulnerability Management, Information Security Expert

Nitin Pandit
Microsoft MVP, Developer Evangelist, Author

Niloshima Srivastava
C# Corner MVP, Tech Architect, Trainer, Blogger

Bala Chirtsabesan
Senior Software Engineer at Microsoft, Author

Manoj Mittal
Sr. Technical Architect, C# Corner MVP, Author

Chandni Di
Co-Founder Voice of Slum

Vithal Wadje
Technical Lead, Microsoft MVP, Author

Shivam Ahuja
Founder SkillCircle, Business Mentor

Chervine Bhiwoo
Solution Architect, Microsoft MVP, Author

Saurabh Jain
Vice President Paytm, Founder Fun2Do Labs, Author

Vinay Solanki
Head IoT at Lenovo, Founder IoT-NCR

Anshu kumari
Founder Blockchainkids, Inventor, Trainer

Amit Singal
CEO Startup Buddy

Dev Pratap
Co-Founder & CEO Voice of Slum

Amey Vartak
Technology Consultant, Full Stack Developer, C# Corner MVP, Author

Viswanatha Swamy
Principal Software Engineer, C# Corner MVP, Author

Sanket Verma
Research Engineer @ Ballistics (Forensics) and Chair, PyData Delhi

Sourabh Somani
Lead Developer, Microsoft MVP, Author

Abhishek Mishra
Software Architect, C# Corner MVP, Author

Siddharth Vaghasia
Technical Consultant, C# Corner MVP, Blogger

Bassam Alugili
Senior Software Specialist, Database Expert

S Ravi Kumar
Solution Architect, C# Corner MVP, Author

Sundaram Subramanian
Full Stack Developer, C# Corner MVP, Speaker

Deepesh Somani
Solution Architect, Microsoft MVP, Author

Debasis Saha
Technical Project Manager, C# Corner MVP, Blogger, Author

Vipul Jain
Software Architect, C# Corner MVP, Author

Akshay Patel
Technical Architect, Microsoft Certified Trainer, C# Corner MVP, Author

Stephen Simon
RPA Developer, Evangelist, Author

Vivek Sharma
Founder Kingster636, AR/VR Specialist

Jeetendra Gund
Technical Lead, C# Corner MVP, Author

Sujal Beniwal
AI Enthusiast, Student

M Viknaraj
Microsoft MVP, Azure Architect, Author

Prasham Sabadra
Software Architect, C# Corner MVP, Trainer, Author

Aakash Maurya
Senior Developer, C# Corner MVP, Speaker

Ankit Sharma
Senior Software Engineer, C# Corner MVP, Author

Mangesh Gaherwar
Team Lead, C# Corner MVP, Author

Viral Jain
Technical Consultant, C# Corner MVP, Author

Bhasker Das
Solution Architect, Evangelist

Manish Dwivedi
Associate Project Manager

Ck Nitin
Programmer, Author

Rohit Gupta
Technical Trainer, Author

Manish Tewatia
Full-stack Marketer, UX Designer

Bhavya Gaur
Technical Illustrator

Rohit Tomar
SEO/SMO Expert

Web Track

Cloud & Data Track

Dev Track

8am-9am

Registration & Breakfast

9am-10am

Future of Desktop Apps with JS (ElectronJs)

Nitin Pandit

Building Serverless Microservices Using Microsoft Azure

Vithal Wadje

Innovating RPA: A Robot for Every Person

Stephen Simon

10am-11am

Managing Cloud Storage Accounts using Logic Apps

Viknaraj Manogararajah

Data visualization using Python

Sekhar Srinivasan

Going Cross platform with AR Foundation

Vivek Sharma

11am-12pm

Keynote

12pm-1pm

Managing your Azure dependencies in ASP.NET Core apps using VS

Bala Chirtsabesan

Securing Applications on Intelligent Azure

Abhishek Mishra

Getting started with Blazor the Framework of Future

S Ravi Kumar

1pm-2pm

Lunch

2pm-2:45pm

Build Progressive Web Apps using Angular 9

Debasis Saha

Build and deploy to any platform using Azure DevOps

Chervine Bhiwoo

Deep Dive in Azure Service Bus

Akshay Patel

2:45pm-3:45pm

Build a Native Mobile Application using React Native and JavaScript

Joseph Guadagno

Making sense of Web Job, Web Job SDK and Functions in Azure

Prakash Tripathi

CloudFront Distribution in AWS

Viral Jain

3:45pm-4pm

Tea Break

4pm-4:30pm

Introduction to PowerBI

Aakash Maurya

Build Advanced SPFx solutions with React and Graph API

Siddharth Vaghasia

Build Business Intelligence Analyst (BIA) Skills

Sundaram Subramanian

4:30pm-5pm

Deep dive of Power Platform – AI BUILDER

Prasham Sabadra

Panel 1

What's new in SharePoint development

Vipul Jain

5pm-5:30pm

Build a SSO (Single Sign On) based Native JavaScript application with Microsoft Identity within 10 minutes

Manoj Mittal

Panel 2

Applications and working of AI

Veena Sarda

5:30pm-6pm

Deploying serverless API's with .Net core 3.0 on AWS & Azure

Amey Vartak

Panel 3

Blockchain with .NET Core (Ark)

Anshu Kumari

6pm-6:30pm

Closing Note & Prize Distribution

Dev Track

Cloud Track

Architecture Track

Emerging Tech Track

8am-9am

Registration & Breakfast

9am-10am

Creating Full-Stack Web Apps Using Server-Side Blazor

Ankit Sharma

Real time face recognition with MS Cognitive Services

Niloshima Srivastava

Building Scalable APIs with GraphQL

Jeetendra Gund

Future of development with AI and Blockchain

Navdeep Garg

10am-11am

Debugging Tips and Tricks with Visual Studio 2019

Joseph Guadagno

Azure Containers

Abhishek Kant

Enterprise Architecture

Naveen Sharma

Bot Framework - learn it fast and look like a boss!

Allen O’Neill

11am-12:30pm

Keynote

12:30pm-1:30pm

.Net Core & C# 8 Performance

David McCarter

Working with Azure kubernetes services

Ritesh Modi

Becoming an Architect

Vidyavrat Agarwal

Why Techies Need to Learn Product Management

Saurabh Jain

1:30pm-2:30pm

Lunch

2:30pm-3:30pm

Build a rules engine in .Net Core

Sanjay Vyas

Building CI and CD Pipeline using Azure DevOps

Sandeep Soni

Entity Framework Core - Tips and Tricks, Performance Optimization, and Tuning

Bassam Alugili

Hacking your way into Data Science

Sanket Verma

3:30-4:15pm

Speed up your .Net Core Website

Sourabh Somani

Azure

Magnus Mårtensson

Demystifying Open Distro for Elasticsearch

Suman Debnath

Future of Data

Shivam Ahuja

4:15pm-4:30pm

Tea Break

4:30pm-5:15pm

gRPC with C# and .Net Core

Mangesh Gaherwar

Panel 1

Essentials of Cloud security

Parveen Malik

Power platform and Dynamics 365

Deepesh Somani

5:15pm-6pm

Microservices - the gRPC Way

Viswanatha Swamy

Panel 2

Reserved

Reserved

6pm-6:30pm

Closing Note & Prize Distribution

Implementing OAuth 2.0 client credentials in C# with IdentityModel

When backend services need to talk to one another without any human in the loop, the OAuth 2.0 client credentials grant is usually the right tool. A console job running on a Sydney-based .NET host can request its own access token, attach it to outgoing HTTP requests, and call a protected API in Melbourne, all without storing a username and password. For C# developers, the IdentityModel library from Duende and the wider .NET community has become the de facto helper for this pattern because it removes the boilerplate around token endpoints, request signing, and JSON parsing.

This article walks through the moving parts of that flow, starting with the basics of how a client credentials grant actually exchanges a client id and secret for a bearer token. It then moves into concrete C# code, including request construction, response parsing, refresh logic, and a few notes on integrating with Australian identity providers such as Microsoft Entra ID, Auth0 regional tenants, and the platforms that sit behind services like the ATO developer portal and Consumer Data Right declarations.

Understanding the client credentials flow for machine-to-machine auth

The client credentials grant is the simplest of the OAuth 2.0 grant types. There is no user, no browser redirect, and no authorisation code. A confidential client, typically a backend service running unattended in a data centre, an Azure region in Sydney, or an on-premises box in a Brisbane office, sends its client id and client secret directly to the token endpoint of an authorisation server. If the credentials are valid and the requested scope is allowed, the server returns an access token, often a signed JWT, that the client then presents as a bearer credential on subsequent calls to a resource server.

What makes this grant attractive to Australian engineering teams is its predictability. There is no consent screen to localise, no PKCE dance to worry about, and no token rotation tied to user sessions. The trade-off is that every service that holds a client secret becomes a high-value target. The Australian Cyber Security Centre's Essential Eight maturity model treats credential management as a first-class control, so storing client secrets in Azure Key Vault, AWS Secrets Manager, or HashiCorp Vault and rotating them on a schedule is more than a nice-to-have. It is the difference between passing an IRAP assessment and being told to come back next quarter.

A subtle point worth keeping in mind: the client credentials flow only works for trusted, server-side callers. You would never embed a client secret in a mobile app, a single-page application, or an Angular bundle served from a CDN in Perth. If your architecture includes such a client, you will need to add an authorisation code flow with PKCE in front of it and keep the client credentials grant reserved for internal service-to-service hops.

Setting up your C# project with IdentityModel packages

IdentityModel is published as a set of NuGet packages under the IdentityModel namespace, and the pieces you actually need for the client credentials grant are small. The workhorse is IdentityModel.Client.HttpClient, which extends HttpClient with RequestClientCredentialsTokenAsync and a strongly typed TokenResponse model. Add it through the Package Manager console or by editing the .csproj directly:

dotnet add package IdentityModel
dotnet add package IdentityModel.Client

For ASP.NET Core projects that want to combine the token client with the Microsoft stack, you will also pull in Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Http so the token client can be registered in DI and injected wherever it is needed. If your services run on .NET 8 or later, the new IHttpClientFactory patterns slot in cleanly. Older code bases still on .NET Framework 4.7.2, common in Australian banks and government agencies that have not finished their migration off legacy systems, can keep using the synchronous TokenClient class, which has been part of the library for years.

Configuration is typically loaded from appsettings.json, environment variables, or a key vault. A reasonable shape for the configuration object looks like this:

public class OAuthSettings
{
    public string Authority { get; set; }
    public string ClientId { get; set; }
    public string ClientSecret { get; set; }
    public string Scope { get; set; }
}

Bind this section in Program.cs with builder.Configuration.GetSection("OAuth") and resolve it through IOptions<OAuthSettings>. Keeping the authority URL as a single setting is helpful when you have separate environments, for example a dev tenant hosted out of Sydney, a UAT tenant in Singapore, and a production tenant in the Azure Australia East region.

Acquiring access tokens with the ClientCredentialsTokenRequest

Once the configuration is in place, requesting a token is mostly a matter of wiring up an HTTP client and calling the right method. A minimal implementation looks like this:

public async Task<TokenResponse> GetTokenAsync(IHttpClientFactory factory)
{
    var client = factory.CreateClient("identity");
    var disco = await client.GetDiscoveryDocumentAsync(_settings.Authority);
    if (disco.IsError) throw new Exception(disco.Error);

    var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
    {
        Address = disco.TokenEndpoint,
        ClientId = _settings.ClientId,
        ClientSecret = _settings.ClientSecret,
        Scope = _settings.Scope
    });

    if (response.IsError) throw new Exception(response.Error);
    return response;
}

The GetDiscoveryDocumentAsync call is worth explaining. IdentityModel follows the OpenID Connect discovery convention and pulls the token endpoint URL from the authority's .well-known/openid-configuration document. This means you do not hard-code https://login.microsoftonline.com/.../oauth2/v2.0/token and risk breaking when Microsoft renames an endpoint, which it has done more than once. For an Australian Entra ID tenant, the discovery URL typically looks like https://login.microsoftonline.com/<tenant-id>/v2.0.

After the token is in hand, attach it to outgoing calls by setting the Authorization header:

request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);

A useful pattern when you are calling multiple downstream APIs from the same host is to wrap each downstream call in a DelegatingHandler that fetches and caches the token automatically. This keeps the bearer token out of business logic and makes it trivial to swap providers, for instance when a service that originally talked to an in-house identity provider starts consuming APIs exposed through the Consumer Data Right registry.

Caching tokens and handling token lifetime in production

Tokens issued under the client credentials grant usually have a lifetime between five minutes and one hour. Asking for a fresh token on every HTTP call would burn CPU on the authorisation server, inflate your logs, and potentially trigger rate limiting on shared tenants, a real concern when you are running against the same Entra ID instance as the rest of the Australian public service. Caching is not optional. It is the only sensible way to run the flow in production.

The simplest cache is an in-memory IMemoryCache entry keyed by the requested scope. On token acquisition, store the access token along with its expires_in value and a small safety margin, say sixty seconds shaved off the end so you never hand out an expired token. When the entry expires, the next call triggers a fresh request. For multi-instance deployments, swap the in-memory cache for a distributed one such as Redis or the SQL-backed DistributedCache you might already have running on a managed instance in Sydney.

Two edge cases deserve attention. First, clock skew: if your service runs on a host whose clock drifts more than a minute or two behind your identity provider, you may receive a token that is already considered expired. Synchronise with time.windows.com or, better, an Australian NTP source such as time.csiro.au. Second, refresh storms: when a cached token expires under load, dozens of worker threads may race to renew it. Guard the renewal with a SemaphoreSlim or a per-scope lock so only one thread issues the actual HTTP request and the others wait for the result.

Comparing token client libraries for C# developers

IdentityModel is not the only way to grab client credentials tokens in C#. Depending on your stack, you might reach for a different library.

Library Setup effort Built-in caching .NET support Best fit
IdentityModel (IdentityModel.Client) Low No, you bring your own .NET Framework 4.6.1 through .NET 8 General client credentials flows against any spec-compliant authorisation server
Microsoft Identity Web (Microsoft.Identity.Web) Medium Yes, via the token cache serializer .NET Core 3.1+ ASP.NET Core apps that authenticate against Entra ID and need MSAL features
MSAL.NET (Microsoft.Identity.Client) Medium Yes, with file or distributed cache .NET Framework and .NET 6+ Daemon apps and confidential clients using the newer recommended client credentials API
Raw HttpClient with manual JSON High Manual Any Custom protocols, restricted environments, or learning the spec from first principles

For most teams in Australia who are calling Entra ID, Auth0, or an on-premises IdentityServer, IdentityModel.Client plus a small caching layer is the sweet spot. It is dependency-light, easy to mock in tests, and does not lock you into a Microsoft-only identity story, a real plus if your integration roadmap includes the Consumer Data Right or cross-jurisdictional APIs.

Practical recommendations for a stable deployment

A few habits separate a client credentials integration that runs quietly for years from one that wakes someone up at 3 a.m.

  • Keep client secrets in Azure Key Vault or an equivalent secrets manager and load them at startup through IConfiguration so they never appear in source control or container images.
  • Treat the token endpoint like any other downstream dependency: instrument it with structured logging, trace it with OpenTelemetry, and alert on non-2xx responses with a meaningful threshold rather than a single failure.
  • Rotate client secrets on a documented schedule, ninety days is a common baseline in Australian government, and rehearse the rotation in a non-production tenant so production cutovers are boring.
  • Pin the version of IdentityModel in your .csproj and review release notes before upgrading; minor versions occasionally tighten validation rules that can surface latent issues in your token handling.
  • Write at least one integration test that exercises the real token endpoint against a sandbox tenant, because mocked token responses tend to drift away from the actual server behaviour faster than anyone expects.

The Leela Ambience Convention Hotel

1, CBD, Maharaj Surajmal Road, Near Yamuna Sports Complex, Delhi, 110032

KNOW MORE

GENERAL QUERIES


Manish Tewatia

+91-9718-431-042

TICKET QUERIES


Atul Gupta

+91-9910-125-804