Skip to content

Initializing PnP.Core from .NET Core Startup Using Only AppSettings.json #1221

Answered by adamfisher
adamfisher asked this question in Q&A
Discussion options

You must be logged in to vote

If I have to do it in code, I tried adding it with this neat PostConfigure method to specify only the certificate via code:

services.PostConfigure<PnPCoreAuthenticationOptions>(options =>
	options.Credentials.Configurations["CertBasedAuthentication"].X509Certificate
			.Certificate = new X509Certificate2("MyPrivateKey.pfx", "1234")
);

I think that will work best and be the most clean if I have to specify it in code otherwise I'm just not sure how it would be serialized and specified in appsettings.json? Let me know if there is a better approach to do it directly in json and I will mark that one as the answer instead.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@adamfisher
Comment options

Answer selected by adamfisher
@jansenbe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants