xamarinhq / app-geocontacts

Xamarin + Azure demo contact list feature Azure AD B2C, Functions, & CosmosDB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Secure Function for Updating Geolocation

jamesmontemagno opened this issue · comments

Secure for Login only of MSAL

-Takes in current lat/long
-Function will reverse geocode to find city/state
-From city/state find the generic lat/long and update the users "CurrentTown"
-Return true

When you get the function done - assign this to me and I'll setup the auth

This was a bit of a wild ride.

Turns out AAD v2 cannot be used in work tenants with API access (like in B2C) it only has access to the Microsoft Graph.

Sooooo... what I did was get the MS Graph token & scope. Then send that scope into the function. The function then calls the Graph sending the token from the app - essentially re-auth'ing. Then using the return value from the Graph - it populates the JSON which will go into the DocumentDb. Yay.

Also have the function writing to DocumentDb - so we'll be able to close this one after my next PR.