2

Has anyone authenticated a client using Windows integrated security from an Apollo Client? Any tips or pointers would be much appreciated

Alan
  • 93
  • 7
  • I haven't seen anything on this. A quick web search brought up essentially nothing which would help you. This doesn't answer the question but is at least remotely related: https://stackoverflow.com/questions/44509832/how-to-set-up-apollo-client-only-after-user-authenticates – T-Heron Dec 04 '17 at 21:30
  • Thanks. I have been trawling the net and found nothing either. Thanks for the link. I saw that too so may need to start exploring some of those concepts – Alan Dec 05 '17 at 12:00
  • The logic is explained here https://stackoverflow.com/questions/13949163/windows-integrated-authentication-in-node-js-client/13960538#13960538 so now the challenge is to code it – Alan Dec 05 '17 at 12:08
  • Microsoft has a Graph API which is rumored to use Windows integrated security. Would that work? – T-Heron Dec 07 '17 at 01:38

1 Answers1

0

Adding credentials: 'include' in the HttpLink seems to be enough (at least with Edge, on a Windows 11 domain box):

const httpLink = createHttpLink({
    uri: 'http://localhost:8080/graphql',
    credentials: 'include'
})

const apolloClient = new ApolloClient({
    link: from([httpLink]),
    cache: new InMemoryCache(),
})

It's a bit magically how this actually works in practice: without adding in that setting the server responds with a HTTP 401, and WWW-Authenticate: NTLM header; adding in the setting I don't actually see the auth flow in the debug tools, just the final authenticated request/response.

Luke Quinane
  • 16,447
  • 13
  • 69
  • 88