hello vishal
If you have custom OAuth details and you need to use them in an Outlook add-in, you can register your app in the Azure portal to securely store and manage your OAuth credentials. Here's how you can save your custom OAuth details in the Azure portal:
- Go to the Azure portal (portal.azure.com) and sign in with your Azure account.
- Navigate to the Azure Active Directory service.
- Under "App registrations" or "Enterprise applications" (depending on the Azure AD version), click on "New registration" to create a new app registration.
- Provide a name for your app and select the appropriate supported account types.
- Set the appropriate redirect URI(s) for your add-in. In the case of an Outlook add-in, the redirect URI will typically be of the form
https://your-addin-domain/owa-auth. - Complete the registration process and note down the generated "Application (client) ID". This will serve as your client ID.
- Depending on your OAuth provider, you may need to configure additional settings such as scopes, permissions, and access tokens. Refer to the documentation of your OAuth provider for specific instructions.
- If your OAuth provider requires a client secret, you can generate one in the "Certificates & secrets" section of the app registration. Click on "New client secret", provide a description, select an expiration option, and click "Add". Note down the generated client secret value.
To access these custom OAuth details (client ID and client secret) in your Outlook add-in JavaScript files, you can use the Office JavaScript API Office.initialize function. Here's an example:
Office.initialize = function (reason) {
var clientId = '<your-client-id>';
var clientSecret = '<your-client-secret>';
// Use the client ID and client secret in your OAuth flow
};
Replace <your-client-id> with your actual client ID and <your-client-secret> with your actual client secret.
Remember to keep your client secret secure and avoid exposing it in your JavaScript files. You can consider using server-side code or a secure storage mechanism to retrieve the client secret when needed, instead of hardcoding it in your add-in code.