'ASP.net Web API authentication using Bearer Token

Good day, i am new to API but i have experience in developing transactional websites using ASP.net MVC. I have multiple working projects now that has common database for basic data like username and password, roles, user details and others.

db1 = project1 login database
db2 = project2 database
db3 = project3 database

In my current situation, the project2 has its own database db2 but i am adding another ConnectionString in web.config for the db1 of login, hence i ended in using multiple database in one project.

now i am developing another project3 and this will be using its own database db3 together with the login credentials from the login db1.

what i want is to login the user in project3 using Web API to authenticate from db1, and still manage to get data to db1 like user info or user roles and can be processed in controller.

i did a research but all i can find is how to create and authenticate server for login, but the client is using a postman for testing, i cant find any ASP.net client related project.

I manage how can i access the Token in using ajax from project1 Web API and save in project3 sessionStorage, but the succeeding request that requires authenticated [Authorized] is not using the token (replies invalid credential).

can someone help me to point out what should i be looking or searching in the web for answer?

Replying a solution here is very much appreciated. Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source