{"id":15295841,"url":"https://github.com/natlee/django-simple-3rd-party-jwt-dev-dashboard","last_synced_at":"2025-04-13T18:34:24.021Z","repository":{"id":63163288,"uuid":"564241418","full_name":"NatLee/Django-Simple-3rd-Party-JWT-Dev-Dashboard","owner":"NatLee","description":"Dashboard for showing 3rd party mixed JWT login with Django backend.","archived":false,"fork":false,"pushed_at":"2024-08-06T06:35:05.000Z","size":46,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T07:51:24.171Z","etag":null,"topics":["3rd-party-login","dashboard","django","django-application","google-login","jwt-authentication","microsoft-login","simple-jwt"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-simple-third-party-jwt-dev-dashboard/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NatLee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-10T09:51:02.000Z","updated_at":"2024-08-06T06:34:14.000Z","dependencies_parsed_at":"2023-01-22T08:30:13.527Z","dependency_job_id":null,"html_url":"https://github.com/NatLee/Django-Simple-3rd-Party-JWT-Dev-Dashboard","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FDjango-Simple-3rd-Party-JWT-Dev-Dashboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FDjango-Simple-3rd-Party-JWT-Dev-Dashboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FDjango-Simple-3rd-Party-JWT-Dev-Dashboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLee%2FDjango-Simple-3rd-Party-JWT-Dev-Dashboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NatLee","download_url":"https://codeload.github.com/NatLee/Django-Simple-3rd-Party-JWT-Dev-Dashboard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248761039,"owners_count":21157479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3rd-party-login","dashboard","django","django-application","google-login","jwt-authentication","microsoft-login","simple-jwt"],"created_at":"2024-09-30T18:08:22.330Z","updated_at":"2025-04-13T18:34:23.993Z","avatar_url":"https://github.com/NatLee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Simple 3rd Party JWT Dev Dashboard\n\n![dashboard](https://i.imgur.com/qrGkUZM.png)\n\nThis is a simple dashboard for showing multi login(JWT, session and 3rd party).\n\nDashboard is used with [Django-Simple-3rd-Party-JWT](https://github.com/NatLee/Django-Simple-3rd-Party-JWT).\n\n## Installation\n\n```bash\npip install django-simple-third-party-jwt-dev-dashboard\n```\n\nCheck it in [Pypi](https://pypi.org/project/django-simple-third-party-jwt-dev-dashboard/).\n\n## Quick Start\n\n- `settings.py`\n\n  Add the followings to your settings of project.\n\n  - (MUST) Install app\n\n  ```python\n  INSTALLED_APPS += [\n      # ---------------------------\n      # debug relative package\n      \"rest_framework\", # \u003c------ MUST\n      #\"drf_yasg\", # (OPTIONAL) for swagger\n      'bootstrap3', # \u003c------ MUST\n      # 3rd party login\n      'django_simple_third_party_jwt' # \u003c------ MUST\n      # debug dashboard\n      'django_simple_third_party_jwt_dev_dashboard', # \u003c------ MUST\n      # ---------------------------\n  ]\n  ```\n\n  - (MUST) Dashboard settings\n\n  ```python\n  # -------------- START - Dashboard Setting --------------\n  DEV_DASHBOARD_SETTINGS = {\n      'jwt_token_url': 'api/auth/token',\n      'jwt_refresh_url': 'api/auth/token/refresh',\n      'jwt_verify_url': 'api/auth/token/verify',\n      'dashboard_url': 'api/__hidden_dev_dashboard',\n      'admin_url': 'api/__hidden_admin',\n      #'swagger_url': 'api/__hidden_swagger', # OPTIONAL\n      #'redoc_url': 'api/__hidden_redoc', # OPTIONAL\n  }\n  # --------------- END - Dashboard Setting -----------------\n\n  # -------------- START - 3rd party login Setting --------------\n  LOGIN_REDIRECT_URL = '/' + DEV_DASHBOARD_SETTINGS['dashboard_url'] # \u003c- (OPTIONAL) for redirect after login\n  JWT_3RD_PREFIX = 'api' # \u003c- (OPTIONAL) for 3rd party login\n  # --------------- END - 3rd party login Setting -----------------\n  ```\n\n  - (MUST) Policy for Google API\n\n  ```python\n  # -------------- START - Policy Setting --------------\n  SECURE_REFERRER_POLICY = \"no-referrer-when-downgrade\"\n  # SECURE_CROSS_ORIGIN_OPENER_POLICY = \"same-origin-allow-popups\"\n  SECURE_CROSS_ORIGIN_OPENER_POLICY = None\n  # -------------- END - Policy Setting -----------------\n  ```\n\n  - (OPTIONAL) Configuration for 3rd party login\n\n  ```python\n  VALID_REGISTER_DOMAINS = [\"gmail.com\", \"hotmail.com\"]\n\n  # -------------- START - Google Auth Setting --------------\n  SOCIAL_GOOGLE_CLIENT_ID = \"376808175534-d6mefo6b1kqih3grjjose2euree2g3cs.apps.googleusercontent.com\"\n  # --------------- END - Google Auth Setting -----------------\n\n  # -------------- START - Microsoft Auth Setting --------------\n  SOCIAL_MICROSOFT_CLIENT_ID = '32346173-22bc-43b2-b6ed-f88f6a76e38c'\n  SOCIAL_MICROSOFT_CLIENT_SECRET = 'K5z8Q~dIXDiFN5qjMjRjIx34cZOJ3Glkrg.dxcG9'\n  # --------------- END - Microsoft Auth Setting -----------------\n\n  ```\n\n\u003e You can regist `SOCIAL_GOOGLE_CLIENT_ID` on Google Cloud Platform.\n\n  [Google Colud | API和服務 | 憑證](https://console.cloud.google.com/apis/credentials)\n\n  1. Create a new project and create a new OAuth 2.0 Client ID.\n    ![](https://i.imgur.com/7UKP3I7.png)\n\n  2. Add `http://localhost:8000` to `Authorized JavaScript origins` and `Authorized redirect URIs`.\n    ![](https://i.imgur.com/IoTRs4j.png)\n\n\u003e You can regist `SOCIAL_MICROSOFT_CLIENT_ID` on Microsoft Azure.\n\n[Microsoft Entra 識別碼 | 應用程式註冊](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps)\n\n  1. Create a new application.\n    ![](https://i.imgur.com/my5UtXv.png)\n  2. Add `http://localhost:8000/api/auth/microsoft/callback` to `Redirect URIs`\n    ![](https://i.imgur.com/lsaZgMM.png)\n  3. Get `Client ID` from `Overview` page.\n    ![](https://i.imgur.com/5oo3xnI.png)\n  4. Get `Client Secret` from `Certificates \u0026 secrets` page.\n    ![](https://i.imgur.com/3F5ge7l.png)\n\n\n- `urls.py`\n\n  URL path for dashboard. (MUST)\n\n  ```python\n  # --------------- 3rd party login\n  # app route\n  urlpatterns += [\n      path(\"\", include(\"django_simple_third_party_jwt.urls\")),\n  ]\n  # ------------------------------\n\n  # --------------- Dashboard\n  urlpatterns += [\n      # debug dashboard\n      path(settings.DEV_DASHBOARD_SETTINGS['dashboard_url'] + \"/\", include(\"django_simple_third_party_jwt_dev_dashboard.urls\")),\n  ]\n  # ------------------------------\n\n  # --------------- Admin\n  urlpatterns += [\n      # admin\n      path(settings.DEV_DASHBOARD_SETTINGS['admin_url'] + \"/\", admin.site.urls),\n  ]\n  # ------------------------------\n\n  # --------------- JWT\n  from rest_framework_simplejwt.views import (\n      TokenVerifyView, TokenObtainPairView, TokenRefreshView\n  )\n  urlpatterns += [\n      path(settings.DEV_DASHBOARD_SETTINGS['jwt_token_url'], TokenObtainPairView.as_view(), name=\"token_get\"),\n      path(settings.DEV_DASHBOARD_SETTINGS['jwt_refresh_url'], TokenRefreshView.as_view(), name=\"token_refresh\"),\n      path(settings.DEV_DASHBOARD_SETTINGS['jwt_verify_url'], TokenVerifyView.as_view(), name=\"token_verify\"),\n  ]\n  # ---------------------------------\n  ```\n\nWhen you added all settings, just run:\n\n```bash\npython manage.py runserver 0.0.0.0:8000\n```\n\nAnd visit `http://localhost:8000/api/__hidden_dev_dashboard`\n\n## Example\n\nCheck `./example/django_simple_third_party_jwt_dev_dashboard_example/`.\n\n## More\n\nThere are several different settings can be added with this dashboard if you need.\n\n- CORS Setting\n\n```python\nALLOWED_HOSTS = [\"*\"]\nLOGIN_REDIRECT_URL = \"/\"\n\n# -------------- START - CORS Setting --------------\nCORS_ALLOW_ALL_ORIGINS = True\nCORS_ALLOW_CREDENTIALS = True\nCSRF_TRUSTED_ORIGINS = [\n    \"http://127.0.0.1\",\n    \"http://localhost\",\n]\n# -------------- END - CORS Setting -----------------\n```\n\n- Swagger setting\n\n```python\n# -------------- Swagger Setting --------------\nSWAGGER_SETTINGS = {\n    \"SECURITY_DEFINITIONS\": {\n        \"Token(add prefix `Bearer` yourself)\": {\n            \"type\": \"apiKey\",\n            \"name\": \"Authorization\",\n            \"in\": \"header\",\n        }\n    },\n    \"LOGIN_URL\": \"/api/__hiddenadmin/login/\",\n    \"LOGOUT_URL\": \"/api/__hiddenadmin/logout/\",\n}\n\n# --------------------------------------------\n```\n\n- SimpleJWT setting\n\n```python\n\n# -------------- Start - SimpleJWT Setting --------------\nfrom datetime import timedelta\nSIMPLE_JWT = {\n    \"ACCESS_TOKEN_LIFETIME\": timedelta(minutes=3600),\n    \"REFRESH_TOKEN_LIFETIME\": timedelta(days=1),\n    \"ROTATE_REFRESH_TOKENS\": False,\n    \"BLACKLIST_AFTER_ROTATION\": False,\n    \"UPDATE_LAST_LOGIN\": False,\n    \"ALGORITHM\": \"HS256\",\n    \"SIGNING_KEY\": SECRET_KEY,\n    \"VERIFYING_KEY\": None,\n    \"AUDIENCE\": None,\n    \"ISSUER\": None,\n    \"JWK_URL\": None,\n    \"LEEWAY\": 0,\n    \"AUTH_HEADER_TYPES\": (\"Bearer\",),\n    \"AUTH_HEADER_NAME\": \"HTTP_AUTHORIZATION\",\n    \"USER_ID_FIELD\": \"id\",\n    \"USER_ID_CLAIM\": \"user_id\",\n    \"USER_AUTHENTICATION_RULE\": \"rest_framework_simplejwt.authentication.default_user_authentication_rule\",\n    \"AUTH_TOKEN_CLASSES\": (\"rest_framework_simplejwt.tokens.AccessToken\",),\n    \"TOKEN_TYPE_CLAIM\": \"token_type\",\n    \"TOKEN_USER_CLASS\": \"rest_framework_simplejwt.models.TokenUser\",\n    \"JTI_CLAIM\": \"jti\",\n    \"SLIDING_TOKEN_REFRESH_EXP_CLAIM\": \"refresh_exp\",\n    \"SLIDING_TOKEN_LIFETIME\": timedelta(minutes=5),\n    \"SLIDING_TOKEN_REFRESH_LIFETIME\": timedelta(days=1),\n}\n# -------------- END - SimpleJWT Setting --------------\n\n```\n\n## Misc tools\n\n### Install \u0026 re-install package\n\n* Linux\n\n```bash\nbash dev-reinstall.sh\n```\n\n* Windows\n\n```powershell\n./dev-reinstall.ps1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlee%2Fdjango-simple-3rd-party-jwt-dev-dashboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatlee%2Fdjango-simple-3rd-party-jwt-dev-dashboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlee%2Fdjango-simple-3rd-party-jwt-dev-dashboard/lists"}