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

  1. Create Azure API
  2. Publish your azure API in Azure
  3. 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

enter image description here

  1. Now the API is protected with Azure AD, if you navigate your API via browser you will be prompted for login
  2. 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
  3. Navigate to Azure management portal, click on active directory in left navigation,

enter image description here

  1. 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)
  2. 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
  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
  4. 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
  5. For APP ID URL, enter unique Url, this will be used as a unique logical identifier for your app.
  6. After the app created, click on Configure, copy the Client ID which will be used later­­
  7. 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
  8. 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
  9. At the bottom of the page, click Manage manifest > Download manifest.
  10. Download the file to a location where you can edit it.
  11. 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.
  12. Click Manage manifest > Upload manifest, and upload the file that you updated in the preceding step.
  13. Azure management portal, select setting and copy your AAD subscription ID for related AAD enter image description here

Thanks in Advance.

  • have you tried using adal.js? That's supposed to be able to do the authentication for you. – russellg Oct 31 '17 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.