Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Prevent possible runtime errors #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Basit-Balogun10
Copy link

@Basit-Balogun10 Basit-Balogun10 commented Jun 9, 2022

  • Renamed givenName and familyName variables to given_name and family_name to ensure profile_data is properly obtained from user_data as the user info endpoint (https://www.googleapis.com/oauth2/v3/userinfo)returns given_name and family_name instead of the former.
  • app_name variable in api/urls.py helps prevent NoReverseMatchError in GoogleLoginApi while reverse function to get api_uri from urls namespaces. This can also be fixed by replacing the second url pattern in config/urls.py with path('api/', include(('api.urls', 'api'), namespace='api')),
  • redirect_uri mismatch errors can easily arise from trailing slashes being the subtle difference between the authorized redirect URIs in the Google console and the redirect_uri value used in the codebase. A quick warning on this can save someone hours of debugging.
  • Adding username to REQUIRED_FIELDS in users/models.py helps to prevent a TypeError from a missing required positional argument (username) in the create_superuser function in the UserManager. This makes it possible to create superusers for testing purposes
  • Added issued_at’ as the fourth argument of jwt_response_payload_handlerto fixTypeError` as a result of excessive arguments (4) coming from https://github.com/Styria-Digital/django-rest-framework-jwt/blob/master/src/rest_framework_jwt/views.py#L34 instead of expected three(3) arguments of the function. This error prevents the traditional email-password login flow from happening successfully.

Basit added 5 commits June 8, 2022 20:25
…' respectively in profile_data in auth/apis.py/GoogleLoginApi because Google returns the user_data in the latter format
…to create superuser for testing purposes, not doing this raises TypeError of a missing positional argument 'username' in UserManager.createsuperuser()
…dler in users/selectors.py to fix TypeError due to too many arguments coming into the function
@RadoRado
Copy link
Member

RadoRado commented Feb 2, 2023

Hello 👋

We'll be moving this repository to our Django Styleguide Example - HackSoftware/Django-Styleguide-Example#330 - so the examples are supported.

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

Successfully merging this pull request may close these issues.

None yet

2 participants