This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="./.sst/platform/config.d.ts" /> | |
export default $config({ | |
app(input) { | |
return { | |
name: "project-name", | |
removal: input?.stage === "production" ? "retain" : "remove", | |
home: "aws", | |
providers: { | |
aws: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import path, re_path | |
from .views import ( | |
CustomProviderAuthView, | |
CustomTokenObtainPairView, | |
CustomTokenRefreshView, | |
CustomTokenVerifyView, | |
LogoutView, | |
) | |
urlpatterns = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from rest_framework.views import APIView | |
from rest_framework.response import Response | |
from rest_framework import status | |
from djoser.social.views import ProviderAuthView | |
from rest_framework_simplejwt.views import ( | |
TokenObtainPairView, | |
TokenRefreshView, | |
TokenVerifyView, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from rest_framework_simplejwt.authentication import JWTAuthentication | |
class CustomJWTAuthentication(JWTAuthentication): | |
def authenticate(self, request): | |
try: | |
header = self.get_header(request) | |
if header is None: | |
raw_token = request.COOKIES.get(settings.AUTH_COOKIE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import ( | |
BaseUserManager, | |
AbstractBaseUser, | |
PermissionsMixin, | |
) | |
class UserAccountManager(BaseUserManager): | |
def create_user(self, email, password=None, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.urls import path, include | |
urlpatterns = [ | |
path("admin/", admin.site.urls), | |
path("api/", include("djoser.urls")), | |
path("api/", include("users.urls")), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOMAIN="localhost:3000 | |
DJANGO_SECRET_KEY="my-django-secret-key" | |
CLOUDINARY_CLOUD_NAME="" | |
CLOUDINARY_API_KEY="" | |
CLOUDINARY_API_SECRET="" | |
REDIRECT_URLS="http://localhost:3000/auth/google,http://localhost:3000/auth/facebook" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[flake8] | |
extend-ignore = E501 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"files.autoSave": "afterDelay", | |
"editor.fontSize": 16, | |
"terminal.integrated.fontFamily": "AnonymicePro Nerd Font", | |
"editor.fontFamily": "AnonymicePro Nerd Font", | |
"terminal.integrated.fontSize": 16, | |
"editor.formatOnSave": true, | |
"editor.formatOnType": false, | |
"editor.defaultFormatter": "esbenp.prettier-vscode", | |
"editor.wordWrap": "on", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In protected routes of App A and App B | |
import { validateToken } from './path-to-shared-auth-service'; | |
// Middleware to check token before accessing protected routes | |
async function requireAuthentication(req, res, next) { | |
const token = req.cookies.authToken; // Retrieve token from cookies | |
const isValidToken = await validateToken(token); | |
if (isValidToken) { |