Hi, I have Kinde connected in my next.js frontend and am sending a bearer_token to my python backend whenever I hit an API. I'm having some trouble authenticating the token though as I'm getting the following error:
server-1 | File "/app/app/routers/videos.py", line 56, in create_videoserver-1 | jwt_authoriation(credentials.credentials)server-1 | File "/app/app/routers/videos.py", line 36, in jwt_authoriationserver-1 | configuration = Configuration(access_token=token)server-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^server-1 | TypeError: Configuration.__init__() got an unexpected keyword argument 'access_token'
server-1 | File "/app/app/routers/videos.py", line 56, in create_videoserver-1 | jwt_authoriation(credentials.credentials)server-1 | File "/app/app/routers/videos.py", line 36, in jwt_authoriationserver-1 | configuration = Configuration(access_token=token)server-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^server-1 | TypeError: Configuration.__init__() got an unexpected keyword argument 'access_token'
Here is my code below:
security = HTTPBearer()class Video(BaseModel): video_url: strdef jwt_authoriation(token: str = None): configuration = Configuration(access_token=token) # Create an instance of the API class api_instance = o_auth_api.OAuthApi(ApiClient(configuration)) try: # Get token details api_response = api_instance.token_introspection() print(api_response) except ApiException as e: print("Exception when calling OAuthApi->token_introspection: %s\n" % e)@router.post("/create", status_code=status.HTTP_201_CREATED,)def create_video( video: Video, db: AsyncSession = Depends(get_db), credentials: HTTPAuthorizationCredentials = Depends(security),): jwt_authoriation(credentials.credentials)
security = HTTPBearer()class Video(BaseModel): video_url: strdef jwt_authoriation(token: str = None): configuration = Configuration(access_token=token) # Create an instance of the API class api_instance = o_auth_api.OAuthApi(ApiClient(configuration)) try: # Get token details api_response = api_instance.token_introspection() print(api_response) except ApiException as e: print("Exception when calling OAuthApi->token_introspection: %s\n" % e)@router.post("/create", status_code=status.HTTP_201_CREATED,)def create_video( video: Video, db: AsyncSession = Depends(get_db), credentials: HTTPAuthorizationCredentials = Depends(security),): jwt_authoriation(credentials.credentials)