I am building an application which fetch and upload documents to sharepoint , I am using Microsoft.SharePoint.Client.ClientContext.
The application is enabled for azure Entra id SSO and successfully receiving the SAML response. Now I am trying to use the same saml xml to authenticate for sharepoint also so that I can access the site and document without asking user for sharepoint credetials again.
I tried to get the token from https://login.microsoftonline.com/xxxxx-c4ca-4cd0-8963-33034cd92c6c/oauth2/v2.0/token by passing the Base64 encoded SAML assertion but it throw error AADSTS50107: The requested federation realm object ‘https://sts.windows.net/9387c2d2-c4ca-4cd0-8963-33034cd92c6c/’ does not exist.
this.Context = new ClientContext(configuration.Url)
{
Credentials = new SharePointOnlineCredentials(configuration.UserName, configuration.Password)
};
for now I am using the SharePointOnlineCredentials with username and password, but I want to omit this and some how if SAML assertion can be used.