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

Request body not well formed during verify #66

Closed
mikesiegel opened this issue Apr 2, 2018 · 2 comments
Closed

Request body not well formed during verify #66

mikesiegel opened this issue Apr 2, 2018 · 2 comments

Comments

@mikesiegel
Copy link

Hello,

I'm trying to prompt the user for push auth via the SDK for testing purposes. According to the documentation this is a valid request :

factor_response = factorClient.verify_factor(user.id, factor.id)

This results in the following call"

curl -i -s -k  -X $'POST' \
    -H $'User-Agent: python-requests/2.18.4' -H $'Content-Type: application/json' -H $'Authorization: SSWS XXXXXX' \
    --data-binary $'{\"activationToken\":null,\"answer\":null,\"passCode\":null,\"nextPassCode\":null}' \
    $'https://example.oktapreview.com/api/v1/users/XXXXX/factors/XXXXX/verify'

Which returns an error The request body was not well-formed.

Fiddling around w/ Postman, submitting no body at all gives the desired results.

@gabrielsroka
Copy link
Contributor

i got the same error. my "workaround" is to patch FactorsClient.verify_factor. change
https://github.com/okta/okta-sdk-python/blob/master/okta/FactorsClient.py#L153-L158

        request = {
            'activationToken': activation_token,
            'answer': answer,
            'passCode': passcode,
            'nextPassCode': next_passcode
        }

to

        request = {
            # 'activationToken': activation_token,
            # 'answer': answer,
            'passCode': passcode,
            # 'nextPassCode': next_passcode
        }

this works ok (ymmv, depending on which arguments you use).

another solution (which might break other things) is to add this to the Serializer class
https://github.com/okta/okta-sdk-python/blob/master/okta/framework/Serializer.py

    def encode(self, obj):
        return JSONEncoder.encode(self, Utils.remove_nulls(obj))

it will remove the nulls

@bretterer
Copy link
Collaborator

We have recently released a 1.x version of this SDK and all api calls and setup is different which should resolve this issue. Please check out our new version on PyPi.

I believe the new update fixes this issue as we have completely redone the SDK and the way API calls are created.

If you find that you are still having an issue, please let us know if you are still having this issue.

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

No branches or pull requests

3 participants