English 中文(简体)
Unable to obtain header values with FastAPI middleware
原标题:

I have limited knowledge of FastAPI. Thanks for any help you can give me.

I want to get a token and process it in the middleware.

However, the problem occurs at the link.

https://github.com/fujitomo/menta-todo/blob/fuji/FE-0004_login/backend/src/other/middleware.py#L30

I have a value set in the header access_token. However, the header value is set as follows

access-control-request-headers : access-token,content-type ,.

The access-token value is set to None.

However, if the following link is set to if True:, the value is set without any problem.

https://github.com/fujitomo/menta-todo/blob/fuji/FE-0004_login/backend/src/other/middleware.py#L30

Do you know the cause of this problem?

I tried Authorize with the following link and the result was the same.

https://indominusbyte.github.io/fastapi-jwt-auth/usage/basic/

Requesting from the Swagger UI, the token value can be obtained without problems.

The problem is when a request is made from React using the process linked below.

https://github.com/fujitomo/menta-todo/blob/fuji/FE-0004_login/backend/src/other/middleware.py#L30

问题回答

Without knowing much Python i can soy maybe the problem comes from using underscore (_) or dash (-) when declaring and using access_token and access-token.





相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签