11# tests/urls.py
2-
2+ from django . contrib import admin
33from django .urls import path , include
4+ from django .conf import settings
45from dj_rest_auth .registration .views import SocialLoginView
56from allauth .socialaccount .providers .oauth2 .client import OAuth2Client
67
78# Import the adapters we need
89from vipps_auth .views import VippsOAuth2Adapter
9- from allauth .socialaccount .providers .google .views import GoogleOAuth2Adapter
10-
1110
1211# --- The Vipps View (Subclassing is Required) ---
1312class VippsLogin (SocialLoginView ):
1413 adapter_class = VippsOAuth2Adapter
1514 client_class = OAuth2Client
16- callback_url = "http://localhost/callback/vipps"
17-
18- # --- The Google View (Subclassing is Required) ---
19- class GoogleLogin (SocialLoginView ):
20- adapter_class = GoogleOAuth2Adapter
21- client_class = OAuth2Client
22- callback_url = "http://localhost/callback/google"
15+ callback_url = settings .VIPPS_API_CALLBACK_URL
2316
2417
2518urlpatterns = [
19+ # This makes the admin panel available at /admin/
20+ path ("admin/" , admin .site .urls ),
21+
2622 # Vipps API endpoint using the required subclass
2723 path (
2824 "api/v1/auth/social/vipps/" ,
2925 VippsLogin .as_view (),
3026 name = "vipps_login_api"
3127 ),
32-
33- # Google API endpoint using the required subclass
34- path (
35- "api/v1/auth/social/google/" ,
36- GoogleLogin .as_view (),
37- name = "google_login_api"
38- ),
3928
4029 # Browser-flow URLs from our package
4130 path ("accounts/" , include ("vipps_auth.urls" )),
31+
32+ # Also include allauth's standard URLs for completeness
33+ path ('accounts/' , include ('allauth.urls' )),
4234]
0 commit comments