We are working on Open ID authentication. For this we are using IdentityModel.OidcClient dll.
We want Access Token and IdentityToken. We can get both the tokens in one call using below code snippet

var result = await _oidcClient.LoginAsync(DisplayMode.Visible);   

LoginAsync is not working. We need to pass IBrowser object in "var options = new OidcClientOptions". We are not able to get IBrowser object.
We created Web Service and we are able to get IdentityToken using below code

var state = await _oidcClient.PrepareLoginAsync();

Above code snippet is returning redirect URI and from that URI we are able to fetch IdentityToken. But here, we are facing issue while fetching Access Token from the "tokenendpoint".

Now, we are using Visual Web Part and using LoginAsync method by passing "System Browser", "Extended Browser" and "WabBrowser" as IBrowser object in OidcClientOptions. We are getting below error

ActiveX control '' cannot be instantiated because the current thread is not in a single-threaded apartment.

It seems either we are missing something or our approach is not appropriate. Please let us know if any other DLL can be used for the same functionality in C#.

| improve this question | | | | |
  • One option is to implement a custom authentication provider. Please take a look on this sharepoint.stackexchange.com/questions/51709/… – Prasanna Apr 3 '19 at 17:55
  • We dont want to change the SharePoint authentication. We want to authenticate a service and want to show data on SharePoint page. – MAK Apr 4 '19 at 9:35
  • This is resolved. – MAK Sep 17 '19 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.