Hi @zxm9501 zxm , yes you can use the Microsoft Authentication Library (MSAL) for this. Please let me know if you have any questions and I can help you further.
If this answer helps you please mark "Accept Answer" so other users can reference it.
Thank you,
James