Fakultas Ilmu Komputer UI

Verified Commit 213e3ba8 authored by Giovan Isa Musthofa's avatar Giovan Isa Musthofa
Browse files

[CHORES] Remove views used to debug oauth

parent 4560c7df
Pipeline #38498 passed with stages
in 3 minutes and 9 seconds
......@@ -5,8 +5,6 @@ from .views import (
EmailVerificationView,
HelloView,
OAuthAccessTokenView,
OAuthAuthorizeView,
OAuthLoginView,
RegisterFullView,
RegisterView,
SecretView,
......@@ -14,15 +12,18 @@ from .views import (
)
urlpatterns = [
path('hello/', HelloView.as_view()),
path('secret/', SecretView.as_view()),
path('user/profile/', UserProfileView.as_view()),
# Auth related path
path('auth/register/', RegisterView.as_view()),
path('auth/register-full/', RegisterFullView.as_view()),
path('auth/access/', AccessTokenView.as_view()),
path('auth/access/oauth/', OAuthAccessTokenView.as_view()),
path('auth/email-verification/', EmailVerificationView.as_view(),
name='email-verification'),
path('auth/login-oauth/', OAuthLoginView.as_view()),
path('auth/authorize/', OAuthAuthorizeView.as_view()),
# Misc PoC path
path('hello/', HelloView.as_view()),
path('secret/', SecretView.as_view()),
# Authenticated user related path
path('user/profile/', UserProfileView.as_view()),
]
......@@ -52,40 +52,6 @@ class SecretView(generics.GenericAPIView):
return Response(msg)
class OAuthLoginView(views.APIView):
def get(self, request, format=None):
from authlib.integrations.django_client import OAuth
oauth = OAuth()
oauth.register(
'google',
server_metadata_url='https://accounts.google.com/.well-known/openid-configuration',
client_kwargs={
'scope': 'openid email profile'
}
)
redirect_uri = request.build_absolute_uri('/auth/authorize')
return oauth.google.authorize_redirect(request, redirect_uri)
class OAuthAuthorizeView(views.APIView):
def get(self, request, format=None):
from authlib.integrations.django_client import OAuth
oauth = OAuth()
oauth.register(
'google',
server_metadata_url='https://accounts.google.com/.well-known/openid-configuration',
client_kwargs={
'scope': 'openid email profile'
}
)
token = oauth.google.authorize_access_token(request)
userinfo = oauth.google.parse_id_token(request, token)
return Response(userinfo)
class RegisterView(generics.CreateAPIView):
"""
RegisterView handles email and password registration.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment