.NET Core SharePointOnlineCredentials class

developer sp1 461 Reputation points
2020-08-04T01:16:04.25+00:00

I'm using the latest CSOM library which should be supported .NET Core solution.
However, I can't find SharePointOnlineCredentials class when coding.

What's the required step to use it in .NET Core solution ?

Thanks for any help please :)

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

3 answers

Sort by: Most helpful
  1. Marc Mora Gibert 1 Reputation point
    2020-08-12T15:42:30.963+00:00

    Hi, there's a way to get Sharepoint Authentication Cookie with this new Authentication model? With old SharepointOnlineCredentials , we used GetAuthenticationCookie method to get this, but with new system I don't know how can I get this. Is it posible?

    Thanks!

    Was this answer helpful?


  2. Baker Kong-MSFT 3,801 Reputation points Moderator
    2020-08-04T06:22:44.513+00:00

    Hi developersp1-9584,

    It's not possible to use SharePointOnlineCredentials in CSOM for .NET Standard. Instead, it's recommended to use OAuth to acquire an access token.
    Here is a blog that demonstrates how to use OAuth 2.0 Resource Owner Password Credentials for fetching the token and use the token in CSOM:

    Best Regards,
    Baker Kong

    Was this answer helpful?


  3. trevorseward 11,711 Reputation points
    2020-08-04T01:53:19.197+00:00

    It has been removed. You shouldn't be using username/pass to access services via API. See https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard#using-modern-authentication-with-csom-for-net-standard for more information.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.