简体   繁体   中英

Auth0 Xamarin and Azure Mobile App Integration

I'm using Xamarin Forms with Auth0. Backend is Azure Mobile Application (not Azure Mobile Service) where database is not tied in.

My authentication works fine in Android. I'm just not sure how to pass this info to backend service, once this is done :

    public static MobileServiceClient client = new MobileServiceClient (
        Constants.applicationURL, Constants.gatewayURL,
        Constants.applicationKey);

    public async void Login()
    {
            await DependencyService.Get<LoginApp.IAuth0WidgetLogin>().LoginUseAuth0EmbeddedWidget();
            App.client.CurrentUser = User.UserName;
            App.client.CurrentUser.MobileServiceAuthenticationToken = User.jwt;

    }

Examples given by Auth0 is at table level permission with some scripting for each table in Azure portal. But my database is not tied in there.

I would instead prefer some code like this .

It would be best if can get back user profile in backend service, so I could user the name to perform audit logs. Maybe using delegation token

var api = await auth0.GetDelegationToken("{THE WAMS CLIENT ID IN AUTH0}");

Are you talking about trying to get a user's Facebook data after they have been authenticated? If so, what I have done is add a custom API endpoint that I can call after the user has been authenticated. Because the call would be made from an authenticated MobileServiceClient object, no further authentication would be needed and your API can call directly to Facebook, Twitter, etc. APIs. From one of those calls, you can get the users username, pictures, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM