0

I have a situation, currently, my application is built using Django and Angular for UI and Backend. In Angular UI I'm using Azure AD for user login to access the application, then it generates the bearer token. I have written all the APIs in Django which are unprotected/less secured Now my question is how can I use the "Bearer token" which got generated by Angular UI for all the Django API calls or Django URLs?

How can I validate the Django URLs using Azure AD???

1 Answers1

0

PLease check if below way and the references can give an idea :

django-auth-adfs uses access token to validate the issuer of the token by verifying the signature. To authenticate against the API you may need to enable the AdfsAccessTokenBackend.

Add this to your AUTHENTICATION_BACKENDS.

AUTHENTICATION_BACKENDS = [
    ...
    'django_auth_adfs.backend.AdfsAccessTokenBackend',
    ...
]

Add this path to your project’s urls.py file.

urlpatterns = [
    ...
    path('oauth2/', include('django_auth_adfs.urls')),
    ...
]

See Azure AD — django_auth_adfs 1.9.7 documentation for further details .

References:

  1. reactjs - DRF "Unauthorized:Stack Overflow
  2. Requesting an access token and access api or ADFS Authentication for Django
  3. python - In Django- Stack Overflow
kavyaS
  • 8,026
  • 1
  • 7
  • 19