'Handling username/password through a bot?

If i were to make a bot for Microsoft Teams, which would give/send you specific data from a third-part website, in this case Moodle. The data is accessed through a rest api call, via a personal token you can find in Moodle. The api uses https.

The problem is; to access certain data, you need to login into Moodle, how should I handle the login through the bot, and where to store it, so the user doesn't have to login every time?

Language is Node.js



Sources

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

Source: Stack Overflow

Solution Source