I have Created the Azure web API using visual studio and hosted it on to the Azure Successfully. If I call the web API using the Chrome App Advanced Rest Client It works properly But, when I try to access it from the SharePoint Online Site using AJAX Call It doesn't work.
I have followed below Steps also Still I am not getting the Solution Please provide the solution with detail explanation
Create and Configure API
- Create Azure API
- Publish your azure API in Azure
- Browse to azure portal, select your API application, select Authentication/Authorizations Set the App Service Authentication: On Action to take when request us not authenticated: Log in with Azure dictionary Authentication providers: Express enter image description here
- Now the API is protected with Azure AD, if you navigate your API via browser you will be prompted for login
- When we set authentication in Express mode, the app will be created automatically in Azure Active directory, you can see the name under Azure AD app
- Navigate to Azure management portal, click on active directory in left navigation,
- Click on the Directory which will be federated to your office 365 (or any source you want to call azure API which uses the same azure active directory as your configured for you API authentication)
- Click on the Application, and you will find you AD app in the list which has been created with Express method as we discussed om step nr.3
- Now we need to create new app in AAD which will be our communication channel from office 365 to Azure API, Click on ADD on footer
- Enter name and select “WEB APPLICATION AND/OR WEB AP” option For Sign in URL enter your SharePoint online Url which you are planning to call Azure API from
- For APP ID URL, enter unique Url, this will be used as a unique logical identifier for your app.
- After the app created, click on Configure, copy the Client ID which will be used later
- Under Permission to other applications, Click “Add Application”, on the next page select “All Apps” and select you Azure API app which you double checked in step nr.8, and confirm
- You will be redirected back to Configure page, Under Permission to other applications, now you see your azure API app is listed here, click on delegated permission, select the access to app
- At the bottom of the page, click Manage manifest > Download manifest.
- Download the file to a location where you can edit it.
- In the downloaded manifest file, search for the oauth2AllowImplicitFlow property. Change the value of this property from false to true, and then save the file.
- Click Manage manifest > Upload manifest, and upload the file that you updated in the preceding step.
- Azure management portal, select setting and copy your AAD subscription ID for related AAD enter image description here
Thanks in Advance.