Hello anonymous user,
Looks like this issue is not related with sharepoint spfx. I think it could be the authentication in your web API.
You could refer to below articles to configure the authentication:
Third-party contact disclaimer:
Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.