简体   繁体   中英

How do I access an Azure Mobile Service as an admin from an app?

I am currently attempting to create a phone app that has some admin-only functions (like doing database metrics and logistics). Unfortunately, for the life of me I can't get it to recognize me as having user.level == 'admin' . I've used the service master secret as the entry for the Mobile Service client, I've logged in using my administrator Microsoft Live account, I've tried different settings in the script permissions itself, all to no avail. Each time, it logs me as being authenticated instead of admin .

Currently my C# code is:

var user = await App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount);
var result = await App.MobileService.GetTable<MyDataRowObject>().ToListAsync();

I then access the result as an IEnumerable .

Thanks!

You can't do this from the mobile service client because accessing the server as admin requires a special header. This is by design, as they don't recommend embedding your master key into a client application.

Instead, you would do this from another trusted service and send the master key as the X-ZUMO-MASTER header.

However, if you want to do this from a particular app you would have a user table that identifies a list of power users and just support login from a standard supported mechanism.

Make sense?

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