Skip to content

Integrity error causes oauth registration view to 500 #1232

Closed

Description

Sentry link

https://openverse.sentry.io/share/issue/8780a79fd7a04eaab42f1f53fe528583/

Description

client_secret = generate_client_secret()
new_application = ThrottledApplication(
name=serialized.validated_data["name"],
skip_authorization=False,
client_type="Confidential",
authorization_grant_type="client-credentials",
verified=False,
client_secret=client_secret,
)
new_application.save()
# Send a verification email.
verification = OAuth2Verification(
email=serialized.validated_data["email"],
code=secrets.token_urlsafe(64),
associated_application=new_application,
)
verification.save()

The above code should be wrapped in a try/except and handle integrity errors with a proper descriptive 400 rather than 500.

Additional context

Marking priority medium as our app should not 500.

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions