locked
calling CRM web API from Sharepoint RRS feed

  • Question

  • We have created a Azure APP to authenticate the CRM webservice. We are using below code such that we can remove the additional Portal.office.com login page. the httprequest is working fine without any issues from firefox but throwing cors issue in IE and Chrome. Is there a way we can update the manifest such that it allows from *.sharepoint.com?

    $.support.cors = true;
                var settings = {
                    "async": true,
                    "crossDomain": true,
                    "url": "https://login.windows.net/XXXXX.onmicrosoft.com/oauth2/token",
                    "method": "POST",
                    "headers": {
                        "cache-control": "no-cache",
                        "content-type": "application/x-www-form-urlencoded",
                      
                        "Access-Control-Allow-Origin": "http://localhost:63321",
                        "Access-Control-Allow-Methods": "POST, GET, OPTIONS, PUT, DELETE",
                        "Access-Control-Allow-Headers": "Content-Type"
                    },
                    "data": {
                        "client_id": "XXXXXXX",
                        "resource": "https://XXXX.crm8.dynamics.com",
                        "username": "sysadmin@XXXX.onmicrosoft.com",
                        "password": "XXXXXX",
                        "client_secret": "XXXXXXX",
                        "grant_type": "password"
                    }
                }

                $.ajax(settings).done(function (response) {
                    debugger;
                    console.log(response);
                });

    Monday, July 31, 2017 10:21 AM