Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthenticationContext.with_client_certificate cannot work with in-memory certificates #568

Closed
rbubley opened this issue Sep 14, 2022 · 1 comment

Comments

@rbubley
Copy link

rbubley commented Sep 14, 2022

AuthenticationContext.with_client_certificate reads in a certificate from a path (cert_path). This is fine if you have a filesystem, but is hard to use if you don't.

It would be good to be able to give the private_key as a string as an alternative to it being read from a file.

@vgrem
Copy link
Owner

vgrem commented Oct 28, 2022

Greetings,

in 2.3.15 version it is supported to pass private_key as a string:

cert_path = 'selfsigncert.pem'
with open(cert_path, 'r') as f:
      private_key = open(cert_path).read()

cert_credentials = {
     'tenant': test_tenant,
     'client_id': '--client id--',
     'thumbprint': '--thumbprint--',
     'private_key': private_key
}
ctx = ClientContext(test_team_site_url).with_client_certificate(**cert_credentials)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants