I have implemented Token based authentication in AngularJS, however my security api (which generates token) is windows based to centralize all AD interaction to one site.
The structure is as follows:
The flow is as follows:
- User is not logged in
- $http request to windows authenticated Security Api is made
- Security Api users AD to create token (authentication handled by windows auth)
- Token returned to app
- All subsequent requests use token to token authenticated apis
This all works fine when the security and app were on the same domain, however as soon as the $http request needs to go across the domain, no Authorization header with windows credentials is sent causing a 401.
Example Request (api is windows authenticated)
Security Api allows cross domain requests by allowing Origin's (* is only for testing not production):
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
Question (TL:DR):
Is it possible, and if so, how do you get the AngularJS client app to passthrough the windows credentials when making a cross domain $http request?