Forum Discussion
johnjohn-Peter
Feb 06, 2024Iron Contributor
Connecting a .net 8.0 console application which uses PnP Core sdk to sharepoint online using certifi
I have create a AD app registration which uses self-signed certificate for authentication. and i grant the AD app registration full control on SharePoint and graph APIs. now i want to build a .net 8...
_Mor10_
Jun 14, 2024Copper Contributor
johnjohn-Peter I think you have swapped the tenantid and clientid parameters for X509CertificateAuthenticationProvider constructor:
// Load the certificate var authenticationProvider = new X509CertificateAuthenticationProvider(tenantId, clientId, X509Certificate2.CreateFromPemFile(certificatePath, certificatePassword));
It is clientid first, then tenantid according to documentation:
public X509CertificateAuthenticationProvider(string clientId, string tenantId, X509Certificate2 certificate)