I'm using Facebook Authentication for my Azure Function App, it works fine if I navigate to a function within the browser. I would like to invoke my functions from within an app but an unsure how to perform the authentication.
At current I am attempting to use the Facebook Client, this returns me an access_token that I am then forwarding to the ".auth/login/facebook/callback" function within my function app. Unfortunately that's as far as I can get, doing this via a GET returns HTML with JavaScript in, and doing it via a POST redirects back to Facebook.
What I really need is the cookie created by the azure function, AppServiceAuthSession, I believe I can then use this to call the functions.
Edit: I don't think i can just use the cookie, like I said above so I need to authenticate properly.
Nick.
I was able to get the tokens passed along to the function app while using the Facebook Javascript SDK (I wasn't having any luck with the C# one) -- maybe this will get you moving in the right direction.
The client:
accessToken
.accessToken
for an 'App Service Token'. It does this by making a POST tohttps://{app}.azurewebsites.net/.auth/login/facebook
with the content{ "access_token" : "{token from Facebook}" }
. This will return back anauthenticationToken
.authenticationToken
in a header namedx-zumo-auth
. Make all requests to your function app using that header.From within your function app, you should then have the current Principal set to that logged in user.