So what is OAuth?
Many of us come into contact with OAuth when browsing around the Web, and most of us aren’t even aware of its existence. OAuth(Open Authentication) is a system that grants third-party websites limited access to user accounts, for example, your Twitter or Facebook accounts.
It lets visitors interact within the site without requiring new account registration or releasing your username and password to third parties.
In this guide, I’d like to introduce the concept of OAuth and how it can apply to developers. There are a lot of technical details involved in the implementation of your OAuth application.
OAuth is an open-standard authorization protocol that allows users to share their private resources (e.g. data, files) stored on one site with another site without having to give away their credentials, typically a password. In this article, we will show you how to integrate Microsoft OAuth into Portainer, a popular open-source tool for managing containerized applications.
Prerequisites: You must have deployed and exposed your portainer application over HTTPS.
Step 1: Register your application with Azure Active Directory (AAD)
Login to your [Azure Portal](https://portal.azure.com/) and choose App registration, click on new app registration to create a new app and update your application URL.
Once done, click on the API-Permissions menu and choose the below permissions to grant access to the OAuth app, (Enable only the relevant needed access) and hit save.
Finally, click on the Certificates & Secrets menu to create a new client secret & id, and copy and store the secrets securely.
Step 2: Configure Portainer with your AAD application
After configuring Portainer with your AAD application, you can now enable OAuth in the Portainer settings. This can be done by navigating to the "Authentication" tab and selecting "Microsoft" as the authentication method.
Update the client ID under the Tenant ID field and the client secret under the Application key, for Application ID head on to the Azure portal and click on your application to view the Application ID.
Step 3: Test the integration
To test that the integration is working correctly, you can log in to Portainer with your Microsoft account. If everything is set up correctly, you should be able to access the Portainer dashboard without any issues.
In summary, integrating Microsoft OAuth into Portainer is a straightforward process that can be completed in four steps: registering your application with Azure Active Directory, configuring Portainer with your AAD application, enabling OAuth in the Portainer settings, and testing the integration. This will provide an added level of security and ease of access for users.