feat(auth): add Google OAuth2 login flow and token endpoint

Added GoogleLoginView and GoogleAuthUrlView to exchange auth code for tokens, create or link users, and return refresh/access tokens. Updated User model with Google ID and serializers for profile data.
This commit is contained in:
sankalp committed 2026-06-25 23:02:25 +05:45
1 parent 996777f937
commit 493cb6774f
5 files changed
+259 -16

No files matched your search

+21 -3
View File
@@ -1,5 +1,23 @@
"""generated with djinit"""
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
# Register your models here.
from src.accounts.models import Setting, User
@admin.register(User)
class UserAdmin(BaseUserAdmin):
list_display = ("id", "email", "name", "is_staff", "is_active")
search_fields = ("email", "name")
ordering = ("email",)
fieldsets = BaseUserAdmin.fieldsets + (("Extra", {"fields": ("google_id",)}),)
@admin.display(description="Name")
def name(self, obj):
return obj.get_full_name() or obj.username
@admin.register(Setting)
class SettingAdmin(admin.ModelAdmin):
list_display = ("id", "user", "group", "key", "value")
list_filter = ("group",)
search_fields = ("key", "value", "user__email")