Closed sweep-ai[bot] closed 1 year ago
AssertionError: The field 'user' was declared on serializer BusinessSerializer, but has not been included in the 'fields' option.
for field in serializer.fields.values():
AttributeError: 'tuple' object has no attribute 'values'
if field.field_name in get_override(serializer, 'exclude_fields', []): AttributeError: 'str' object has no attribute 'field_name'
Still getting redirected to /accounts/profile/ :(
Page not found (404) Request Method: GET Request URL: http://localhost:8000/accounts/profile/
Nope! What I need is to return the same data saved in Django adminstration -> Home-> Social Accounts -> Social accounts -> account1
The data looks like this:
User: account1 Provider: Google Uid: 126458457777777999999 Extra data: {"iss": "https://accounts.google.com", "azp": "716529444916-gnqbiqic5hgjfsff5onjlt9idr5gvg2b.apps.googleusercontent.com", "aud": "716529444916-gnqbiqicj4gje8gf5onjlt9idr5gvg2b.apps.googleusercontent.com", "sub": "126458457777777999999", "email": "account1.email@gmail.com", "email_verified": true, "at_hash": "1L5vbSRKwe4C3JkUTdI9ap", "name": "Account One", "picture": "https://lh3.googleusercontent.com/a/AAcHTteaRtxDoddd1Rys2WZyreexZfeqKqWk_R75qf-U5pLS-Q=s96-c", "given_name": "Account", "family_name": "One", "locale": "en", "iat": 1691859542, "exp": 1691863142}
ImportError: cannot import name 'get_social_account' from 'allauth.socialaccount.models' (/workspaces/Backend/backend/venv/lib/python3.10/site-packages/allauth/socialaccount/models.py)
Description
This PR fixes the Google authentication in the backend to return the user token, name, and email as a response for login. Currently, the user is redirected to the profile page after login, but no token is returned in the response. This update is necessary to enable users to access their personal profiles in the mobile apps.
Summary of Changes
GoogleLoginView
class inba7besh/views.py
to include the user token, email, and name in the response for login. Theid_token
returned by Google is used to generate the user token.UserSerializer
class inba7besh/serializers.py
to include the user token, email, and name fields in the response for login.Please review and merge these changes to enable proper Google authentication and return the necessary user information in the login response.
Fixes #12.
To checkout this PR branch, run the following command in your terminal:
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.