Skip to content

Commit

Permalink
Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronnie5562 committed Aug 2, 2024
1 parent 0b86880 commit c0ff132
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions docnet_backend/accounts/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ def process_request(self, request):
token = request.COOKIES[token_name]
csrf_token = request.COOKIES.get("csrftoken", "")


print(f"token: {token}")
print(f"csrf_token: {csrf_token}")

request.META['HTTP_AUTHORIZATION'] = f'Bearer {token}'
request.META['HTTP_X_CSRFTOKEN'] = csrf_token

9 changes: 3 additions & 6 deletions docnet_backend/docnet_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,12 @@
# To allow POST request from frontend
CSRF_TRUSTED_ORIGINS = [
'http://localhost:5173',
'http://127.0.0.1:5173',
'https://docnet-frontend.onrender.com',
'https://docnet-test.onrender.com',
]

CORS_ALLOWED_ORIGINS = [
'http://localhost:5173',
'http://127.0.0.1:5173',
'https://docnet-frontend.onrender.com',
'https://docnet-test.onrender.com',
]
Expand All @@ -213,13 +211,12 @@
# JWTCookie settings
"ACCESS_TOKEN_NAME": "access",
"REFRESH_TOKEN_NAME": "refresh",
"JWT_COOKIE_SAMESITE": "None", # Use None for cross-site requests (Lax)
"JWT_COOKIE_SAMESITE": "Lax", # Use None for cross-site requests (Lax)
"JWT_COOKIE_SECURE": True, # Ensure cookies are sent over HTTPS
}


# Cookie settings
SESSION_COOKIE_SAMESITE = 'None'
SESSION_COOKIE_SAMESITE = 'Lax'
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SAMESITE = 'None'
CSRF_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SECURE = True

0 comments on commit c0ff132

Please sign in to comment.