Skip to content

Commit

Permalink
Merge pull request #77 from hotosm/auth
Browse files Browse the repository at this point in the history
remove duplicate endpoint for refresh token
  • Loading branch information
nrjadkry authored Jul 18, 2024
2 parents 715b4b6 + 10ec63d commit 6102562
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ DockerData/
src/backend/templates/*

# precommit
.ruff_cache/
.ruff_cache/
16 changes: 1 addition & 15 deletions src/backend/app/users/user_routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from datetime import timedelta
from fastapi import APIRouter, Response, HTTPException, Depends
from typing import Annotated
from fastapi.security import OAuth2PasswordRequestForm
Expand All @@ -7,7 +6,7 @@
ProfileUpdate,
AuthUser,
)
from app.users.user_deps import CurrentUser, login_required
from app.users.user_deps import login_required
from app.config import settings
from app.users import user_crud
from app.db import database
Expand Down Expand Up @@ -44,19 +43,6 @@ async def login_access_token(
return Token(access_token=access_token, refresh_token=refresh_token)


@router.get("/refresh_token")
def update_token(current_user: CurrentUser):
access_token_expires = timedelta(minutes=settings.ACCESS_TOKEN_EXPIRE_MINUTES)
refresh_token_expires = timedelta(minutes=settings.REFRESH_TOKEN_EXPIRE_MINUTES)

access_token, refresh_token = user_crud.create_access_token(
current_user.id,
expires_delta=access_token_expires,
refresh_token_expiry=refresh_token_expires,
)
return Token(access_token=access_token, refresh_token=refresh_token)


@router.post("/{user_id}/profile")
async def update_user_profile(
user_id: str,
Expand Down

0 comments on commit 6102562

Please sign in to comment.