I'm trying to access Dynamics CRM OData using AngularJS but I'm not sure where to set my credentials. I'm getting a 401 (Unauthorized) error with this code:
angularDynamicsCRM.factory('DynamicsCRMService', function ($resource) { var oDataUrl = Xrm.Page.context.getClientUrl() + '/XRMServices/2011/OrganizationData.svc/';
var defaultParams = {}; /// describe our API actions var actions = { lookup: { method: 'GET', url: oDataUrl + ':entitySet?$filter=startswith(:field, \':search\')', withCredentials: true } }; /// create the service return $resource(oDataUrl, defaultParams, actions); });
How can I set my CRM credentials when accessing the OData using this code?