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

Bug: channel field error in MFA challenge (Python) but not required in the documentation #921

Closed
wstammSeidor opened this issue Sep 5, 2024 · 1 comment · Fixed by #947
Assignees
Labels
bug Something isn't working

Comments

@wstammSeidor
Copy link

Description:
I am experiencing a discrepancy between the Supabase documentation and the behavior in my Python environment when trying to create an MFA challenge. According to the documentation (both for JavaScript and Python), only the factor_id is required to create an MFA challenge, but in my Python code, the SDK raises an error stating that the channel field is missing.

This issue only happens in the containerized environment, not in my local development setup. On my local machine, the same code works without issues, but in the Docker container, it fails with a KeyError on the channel field.

Steps to Reproduce:
Python SDK: Using Supabase's Python SDK, I am trying to create an MFA challenge.

Environment: The issue occurs when running the code inside a Docker container. The same code works without problems in my local environment.

Code snippet (relevant portion):

python
Copiar código
response = supabase.auth.sign_in_with_password(credentials)
if response.user.factors:
factor_id = response.user.factors[0].id # Extract the factor ID

data = {
    "factor_id": factor_id  # Only sending factor_id as per documentation
}

try:
    res = supabase.auth.mfa.challenge(data)  # This line raises a 'channel' KeyError in the container
    challenge_id = res.id
    return Response({
        "mfa": True,
        "factor_id": factor_id,
        "challenge_id": challenge_id
    }, status=status.HTTP_200_OK)
except Exception as e:
    print(f"Error: {str(e)}")
    return Response({'detail': str(e)}, status=status.HTTP_400_BAD_REQUEST)

Expected Behavior:
The MFA challenge should be created using just the factor_id, as per the documentation. In the JavaScript SDK documentation, it clearly shows that only factorId is required, and the Python SDK documentation mirrors this expectation.

Actual Behavior:
In the Docker container, the mfa.challenge call raises the following error:

vbnet
Copiar código
KeyError: 'channel'
This error suggests that the channel field is required, which contradicts the documentation. This issue does not occur in my local environment—the same code runs perfectly fine.

@wstammSeidor wstammSeidor added the bug Something isn't working label Sep 5, 2024
@silentworks silentworks self-assigned this Sep 29, 2024
@silentworks silentworks linked a pull request Sep 30, 2024 that will close this issue
@silentworks
Copy link
Contributor

This should now be fixed in the latest 2.8.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants