You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.1 KiB

2 years ago
2 years ago
2 years ago
  1. from django.conf import settings
  2. from rest_framework.response import Response
  3. from rest_framework.views import APIView
  4. class Social(APIView):
  5. permission_classes = ()
  6. def get(self, request, *args, **kwargs):
  7. return Response(
  8. {
  9. "okta": {
  10. "type": "oauth2",
  11. "base_url": settings.SOCIALACCOUNT_PROVIDERS.get("okta").get("OKTA_BASE_URL"),
  12. "client_id": settings.SOCIALACCOUNT_PROVIDERS.get("okta").get("APP").get("client_id"),
  13. "redirect_path": "/social/complete/okta-oauth2",
  14. "authorize_url": "https://"
  15. + settings.SOCIALACCOUNT_PROVIDERS.get("okta").get("OKTA_BASE_URL")
  16. + "/oauth2/v1/authorize?response_type=code&client_id="
  17. + settings.SOCIALACCOUNT_PROVIDERS.get("okta").get("APP").get("client_id")
  18. + "&scope=openid&state=unknown&response_mode=form_post",
  19. }
  20. if settings.SOCIALACCOUNT_PROVIDERS.get("okta").get("OKTA_BASE_URL")
  21. else {},
  22. }
  23. )