Git Product home page Git Product logo

azurefunctionseasyauth's Introduction

AzureFunctionsEasyAuth

Contents

Intro

A repo with sample code for using Azure Functions with App Service Authentication ("EasyAuth")

EasyAuth provides integration with a number of authentication providers, but for simplicity this sample uses facebook integration.

Projects

There are two projects in the solution:

  • src/FunctionWithAuth - this is the Azure Functions implementation
  • src/SampleWebClient - this is a sample client to make it easy to test the Azure Functions in an interactive way

Outline

The rough outline for the sample is shown in the diagram below.

The browser loads the HTML/JS/CSS for the Web App. The Web App uses the Facebook/Google JavaScript SDKs to authenticate with the identity provider. Once it has the token from the provider, it passes that to the EasyAuth endpoint on the Function App which translates it into an EasyAuth token. This EasyAuth token is then passed on calls to the Azure Function endpoints to call them as the authenticated user.

+--------------------+            +--------------------+
|                    |            |                    |
|                    |            |                    |
|                    +------------>  Azure             |
|  Browser           |            |  Web App           |
|                    |            |                    |
|                    |            |                    |
+--------------------+            +--------------------+
    |             |
    |             |
    |             |
    |             |               +--------------------+
    |             |               |                    |
    |             |               |                    |
    |             +--------------->  Azure             |
    |                             |  Function          |
    |                             |                    |
    |                             |                    |
    |                             +--------------------+
    |
+---v----------------+
|                    |
|                    |
|  Identity provider |
|  e.g. Facebook,    |
|  Google            |
|                    |
+--------------------+

Deployment

If you want a quick way to see the sample in action without deploying it yourself then visit https://easyauthweb.azurewebsites.net/.

To deploy the sample with Facebook and/or Google integration:

  1. Create applications with one or both of the the identity providers

    1. Create a Facebook application at https://developers.facebook.com and make a note of the App ID and App Secret
    2. Create a Google application at https://developers.google.com/identity/sign-in/web/sign-in and make a note of the Client ID and Client Secret
  2. Deploy the template (you can use the big deploy button below).

    You can enter the ID + Secret for Facebook, Google, or both, dependending on what you configured above

    When the template has finished deploying, make note of the web app url.

  3. Update the configuration with the identity providers

    1. Configure the Facebook application:
      • set the AppDomains to the domain for the web app
      • add a website and set the Site Url to the URL of the web app
    2. Configure the Google application to set the Authorised JavaScript Origin to the URL of the web app
  4. Go to the URL of the web app and test the application!

Deploy to Azure

azurefunctionseasyauth's People

Contributors

stuartleeks avatar

Watchers

Zac H avatar

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.