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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

How to get AssemblyAuthenticationContext from getService() in plugin?

(0) ShareShare
ReportReport
Posted on by

I've seen IAssemblyAuthenticationContext used in plugins. I want to instantiate it in particular so I can use its AcquireToken() method. However, whenever I look in serviceProvider that is passed into the Execute() function for it, it is never available. This makes my AssemblyAuthContext variable below always null.

public void Execute(IServiceProvider serviceProvider)
{
    var PluginExecutionContext = serviceProvider.Get();
    var TracingService = new LocalTracingService(serviceProvider);
    
    // This is always null
    var AssemblyAuthContext = serviceProvider.Get();
    
    // What I wwant to do
    string token = AssemblyAuthContext.AcquireToken("url", "authResource, AuthenticationType.ClientAssertionCertificateWithX5c);
}

Anyone know how to make this available in a plugin? Do you have to pass it in somehow?

I have the same question (0)
  • Eric benco Profile Picture
    320 on at

    what if happens if you try

    serviceProvider.GetService(typeof(IAssemblyAuthenticationContext));

  • vdblohowiak Profile Picture
    on at

    It's the same method as doing serviceProvider.Get<IAssemblyAuthenticationContext>();

    I can debug the plugin and inspect what's in serviceProvider. Nothing of type "IAssemblyAuthenticationContext" is in there.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans