Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Sales forum / How to connect to Dyna...
Sales forum
Suggested answer

How to connect to Dynamics 365 Web API using OAuth 2.0 in c#?

Posted on by Microsoft Employee

Hello Community,

I need to make a connection & CRUD in dynamics 365 using oAuth2 or using Azure App details(ClientID, Client Secret) in C# code,  Can anyone suggest the way to achieve that using Dynamics CRM SDK?  Is there any other method or SDK for oAuth2?

Thanks

Categories:
  • Suggested answer
    cloflyMao Profile Picture
    cloflyMao 25,194 on at
    RE: How to connect to Dynamics 365 Web API using OAuth 2.0 in c#?

    Hi Sandhya,

    SDK and Web API(OAuth 2) are two different approaches:

    .NET framework is required to use SDK, and SDK uses Organization service to connect to Dynamics environment.

    Web API could be regarded as http request, hence we only need some system libraries(such as system.net.http) without importing SDK assemblies if we are working in Web API style.

    (To be precise, besides system libraries, Active Directory assembly is required to authenticate Azure app.)

    Please refer to following article, it gives complete steps to register Azure app and a sample C# code.

    https://www.c-sharpcorner.com/article/generate-access-token-for-dynamics-365-single-tenant-server-to-server-authentica/

    Regards,

    Clofly

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: How to connect to Dynamics 365 Web API using OAuth 2.0 in c#?

    Hi,

    Please refer to below link which explains how to connect D365 Web API using OAuth 2 with C# Code sample:

    nishantrana.me/.../

    Best,

    Wahaj

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans