Coder Social home page Coder Social logo

applicationkeyazure's Introduction

applicationKey Azure Mobile App

You can set an application key for your Azure Mobile App like Azure Mobile Services.

1. Open Application Settings on Azure Mobile Application

Image

2. Scroll down to App Settings Add these two lines.

Definition Value
zumo-api-key TYPE YOUR API KEY
MS_SkipVersionCheck True

Image

3. Then click Save

4. Open App Service Editor

5. Create a file on your main folder wwwroot

Image

6. Name your file as validateApiKey.js

validateApiKey.js

6. Update your API script as,

sampleAPI.js AND sampleAPI.json

Do not forget to change permissions to "Anonymous"

6. Update your Table script as,

sampleTable.js AND sampleTable.json

Do not forget to change permissions to "Anonymous"

7. Done!

Do not forget to add header while calling Azure Mobile/Web App.

**If you are using WindowsAzure.MobileServices

MobileServiceClient client = new MobileServiceClient(keys.mobileServiceAdress, keys.appSecret, new AppKeyHandler());
IMobileServiceTable<notifications> uTable = client.GetTable<notifications>();
await uTable.InsertAsync(n);

**If you are using Microsoft.Azure.Mobile.Client

MobileServiceClient client = new MobileServiceClient(keys.mobileServiceAdress, new AppKeyHandler());
IMobileServiceTable<notifications> uTable = client.GetTable<notifications>();
await uTable.InsertAsync(n);
public class AppKeyHandler : DelegatingHandler
{
  protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  {
    request.Headers.Add("zumo-api-key", keys.mobileServiceKey);
    return base.SendAsync(request, cancellationToken);
  }
}

ps. Feel free to ask questions via "Issues".

thisisfatih.

applicationkeyazure's People

Contributors

thisisfatih avatar

Stargazers

 avatar Akshay Kumar Gupta avatar

Watchers

James Cloos avatar Carlo Mendoza avatar  avatar

applicationkeyazure's Issues

anonymous or authenticated

Thank you for this information! But you mention setting permissions to "anonymous", however, anonymous doesn't require permissions. Did you mean don't forget to change permissions to "authenticated?"

Thanks Again!

Client code

In the client code
public static MobileServiceClient MobileService =
new MobileServiceClient(
keys.url,new AppKeyHandler()
);
is enough.. we can not send the key in this MobileServiceClient . and it still works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.