web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Microsoft.PowerPlatfor...
Power Apps
Unanswered

Microsoft.PowerPlatform.Dataverse.Client.ServiceClient OAuth login fails for .NET 6.0

(0) ShareShare
ReportReport
Posted on by 6

Currently I am using NuGet package Microsoft.PowerPlatform.Dataverse.Client to connect to Dataverse from a console app. I have two console app versions, one on .NET 4.8 and one on .NET 6.0. Version 4.8 is working fine, but 6.0 fails when it attempts an OAuth login for an organization using a custom login page.

 

 

var client = new ServiceClient(@"AuthType=OAuth;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;TokenCacheStorePath='C:\Data\token6.bin';Username=name@test.test;Url=https://companyname.crm4.dynamics.com/;LoginPrompt=Auto;");

 

 

This code fails with this exception:

Error at Microsoft.PowerPlatform.Dataverse.Client.Auth.AuthProcessor.ProcessMsalExecptionAsync(Uri serviceUrl, ClientCredentials clientCredentials, X509Certificate2 userCert, String clientId, Uri redirectUri, PromptBehavior promptBehavior, Boolean isOnPrem, String authority, Object msalAuthClient, DataverseTraceLogger logSink, Boolean useDefaultCreds, MemoryBackedTokenCache memoryBackedTokenCache, String tokenCacheStorePath, MsalException msalEx)
// (Microsoft.Identity.Client.MsalClientException: Only loopback redirect uri is supported, but app://58145b91-0c36-4500-8554-080854f2ac97/ was found. Configure http://localhost or http://localhost:port both during app registration and when you create the PublicClientApplication object. See https://aka.ms/msal-net-os-browser for details)

 

Again, the exact same code works perfectly fine on .NET 4.8. It also works on .NET 6.0 when a valid token is already present at the given location or when the organization does not use a customized login page, so my guess is the error is in the handling of custom login pages.

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    Tagging @MattB-MSFT because this is also ServiceClient related, but it does seem like more of an MSAL issue than ServiceClient.

  • MattB-MSFT Profile Picture
    Microsoft Employee on at

    Redirect link on .net core for client apps is http://localhost.  (Not https) 
    this is an msal thing, and it is documented on our docs for service client. 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard