Exception while requesting OAuth 2.0 credentials
Closed this issue · 2 comments
This is not a duplicate of #348, but I've been having trouble getting this to work with Microsoft 365:
Caught exception while requesting OAuth 2.0 credentials ...
TypeError("load_pem_x509_certificate() missing 1 required positional argument: 'backend'")
But after following solutions to the same issue in the Certipy repo I fixed that by upgrading cryptography to 3.5. Now I get a different error:
Caught exception while requesting OAuth 2.0 credentials...
ValueError('too many values to unpack (expected 2)')
I generated the certificate and key using the command suggested by #247 and I can't quite figure out why it's erroring. Searching online only returns very old and unrelated issues.
Could this be something to do with configuration on the Microsoft side? I have created an App in Entra, and assigned the needed scopes and my certificate to it.
Thanks!
The later error was user error, I missed the part about replacing the tenant ID for the permission and token URLs.
I can still reproduce the first error when using the specified version of cryptography though, it does not work unless I upgrade it to >=3.5.
Thanks for reporting this (and for following up about the second error).
Regarding the first issue, this is indeed a compatibility problem with older versions of cryptography. I'm not keen to bump the minimum version yet given that JWT usage with the proxy is still I believe relatively rare, so instead 49fad23 adds the optional backend parameter.