Thanks for reaching out to Q&A.
You can refer to the below articles that will guide you in connecting from Sharepoint hosted addin
You can also explore using MSAL js in SP addin
https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-javascript-spa
The sharepoint hosted addins are legacy and I would suggest using the SpFx : https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/guidance/connect-to-api-secured-with-aad
I hope this helps!
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.