FastAPI - Authentication and Security
Examine the following FastAPI code snippet for Bearer token handling:
from fastapi import FastAPI, Depends
from fastapi.security import OAuth2PasswordBearer
app = FastAPI()
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
@app.get("/profile")
async def profile(token: str = oauth2_scheme):
return {"token": token}
What is the main issue with this code?