Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Okta Login for newer versions of Doccano #2079

Merged
merged 9 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint issue
  • Loading branch information
Clovin committed Dec 2, 2022
commit 46afe80207d8244cb8da85be7d0ec124755452e4
1 change: 1 addition & 0 deletions backend/social/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from dj_rest_auth.registration.views import SocialLoginView
from allauth.socialaccount.providers.oauth2.client import OAuth2Client


class OktaLogin(SocialLoginView):
adapter_class = OktaOAuth2Adapter
callback_url = '/projects'
Expand Down
8 changes: 5 additions & 3 deletions backend/social/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework.views import APIView
from django.conf import settings


class Social(APIView):
permission_classes = ()

Expand All @@ -13,8 +14,9 @@ def get(self, request, *args, **kwargs):
'client_id': settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id'),
'redirect_path': '/social/complete/okta-oauth2',
'authorize_url':
'https://' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') +
'/oauth2/v1/authorize?response_type=code&client_id=' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id') +
'&scope=openid&state=unknown&response_mode=form_post'
'https://' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL')
+ '/oauth2/v1/authorize?response_type=code&client_id='
+ settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id')
+ '&scope=openid&state=unknown&response_mode=form_post',
} if settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') else {},
})