Segfault when using QAbstractOAuth::setModifyParametersFunction
Bryce Beagle
bryce.beagle at gmail.com
Tue May 11 19:21:06 BST 2021
Hi, I'm trying to implement OAuth 2.0 Authorization Code Flow with PKCE in
my PyQt application and am having trouble making use of
QAbstractOAuth::modifyParametersFunction in my QOAuth2AuthorizationCodeFlow
subclass.
>>> print(self.modifyParametersFunction)
<built-in method modifyParametersFunction of CognitoOAuthFlow object at
0x7f8ea0162b80>
>>> print(self.modifyParametersFunction())
SystemError: <built-in method modifyParametersFunction of CognitoOAuthFlow
object at 0x7f8ea0162b80> returned NULL without setting an error
This isn't *too* surprising as this function pointer should be set to NULL
within Qt until QAbstractOAuth::setModifyParametersFunction is called, but
I would expect it to have a more elegant PyQt return value (such as a
Python None), or to throw a more descriptive error.
However, and this is causing my issues, I can't figure out how to actually
use QAbstractOAuth::setModifyParametersFunction properly.
>>> def modifyParamsFunction(stage: QAbstractOAuth.Stage, parameters: dict):
... if stage is QAbstractOAuth.RequestingAuthorization:
... parameters["identity_provider"] = "COGNITO"
... parameters["code_challenge_method"] = "S256"
... ... # other stuff
>>> class CognitoOAuthFlow(QOAuth2AuthorizationCodeFlow):
... def __init__(*args, **kwargs):
... ...
... self.setModifyParametersFunction(modifyParamsFunction)
When I try using CognitoOAuthFlow.grant() (after setting up my
URLs/scopes/identifiers/etc.), I get a segfault.
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Is there something I'm missing here? If necessary, I can try to provide a
more complete example, but it might require me to include information about
our authorization flow.
Thanks,
Bryce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210511/830bbab0/attachment.htm>
More information about the PyQt
mailing list