Creating a Custom OAuth App
When to Create a Custom OAuth AppCreating a custom OAuth app is required in the web flow. Creating a custom OAuth app is optional for desktop and headless applications; the component is already registered with Excel Online and you can connect with its embedded credentials.
You might want to create a custom OAuth app to change the information displayed when users log into the Excel Online OAuth endpoint to grant permissions to the component.
Follow the steps below to create a custom OAuth app and obtain the connection properties in a specific OAuth authentication flow.
Steps to Create a Custom OAuth App
Follow the steps below to obtain the OAuth values for your app, the OAuthClientId and OAuthClientSecret.
- Log in to https://portal.azure.com.
- In the left-hand navigation pane, select Azure Active Directory then App Registrations and click the New registration button.
- Enter an app name and set the radio button for the desired tenant setup. Then set the redirect url to something such as http://localhost:33333, the component's default. Or, set a different port of your choice and set CallbackURL to the exact reply URL you defined.
- Define the app authentication type by going to the Certificates & Secrets section. There are two types of authentication available: using a client secret and using a certificate.
The recommended authentication method is via a certificate, but you can also create an application secret.
- Option 1 - Upload a certificate: In the Certificates & Secrets section, select Upload certificate and select the certificate to upload from your local machine.
- Option 2 - Create a new application secret: In the Certificates & Secrets section, select New Client Secret for the app and select its duration. After saving the client secret, the key value is displayed. Copy this value as it is displayed only once, and it is used as the OAuthClientSecret.
- Select API Permissions and then click Add. If you plan for your app to connect without a user context, select the Application Permissions (OAuthGrantType = CLIENT). Otherwise, when selecting permissions, use the Delegated permissions.
- Add the following application permissions: Sites.Read.All, Files.Read, Files.Read.All, Files.Read.Selected, Files.ReadWrite, Files.ReadWrite.All, Files.ReadWrite.AppFolder, Files.ReadWrite.Selected, and offline_access.
- Save your changes.
- If you have selected to use permissions that require admin consent (such as the Application Permissions), you may grant them from the current tenant on the API Permissions page. Otherwise, follow the steps under Admin Consent.