GitXplorerGitXplorer
f

vue-flask-azure-ad

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Verified
27299101d698becf6f6b01d794acc218a90190f1

Merge pull request #1 from Japanuspus/cors-config

ffuglede committed 4 years ago
Unverified
a7e71f4e0835e027020d10a52e8185cb39afb6d3

Implement review suggestions

JJapanuspus committed 4 years ago
Unverified
5dd3a75b3a230d9b8e6e08a37f9fdec48aa2be7e

Use CORS configuration to allow credentials

JJapanuspus committed 4 years ago
Unverified
008d9286f95973c05f518a084126b5308146607f

Move authentication ID's to .env.local

JJapanuspus committed 4 years ago
Unverified
c57fa73b385e96e1f37714fdc2ab3405ddcfc427

Initial commit

ffuglede committed 4 years ago

README

The README file for this repository.

Vue.js + MSAL.js + Flask + Azure AD authentication example

This repository contains a simple example on how to protect a Flask API endpoint with an app role defined in Azure, together with a Vue.js app for accessing this endpoint.

It is intended as a starting point for new applications that have resources that need to be secured, or as a simple collection of code samples for building authentication into existing samples.

It is inspired by the examples available in sunilbandla/vue-msal-sample and antarctica/flask-azure-oauth.

Configuration

  1. Create an app registration in Azure for the API project.

    a. In "Expose an API", create a scope called "Read.All", whose "Who can consent" is "Admins and users".

    b. In the "App roles" menu, create a new app role whose "Allowed member types" is "Users/Groups" and whose Value is "Write.All".

    c. In API permissions, click "Enterprise application", then in "Users and groups", add a user whose role is the one created in the step above.

  2. Create an app registration in Azure for the frontend project. Use http://localhost:8080/ as a redirect URI.

    a. In the "Manifest" menu, define

	"oauth2AllowIdTokenImplicitFlow": true,
	"oauth2AllowImplicitFlow": true,
  1. Make a copy of app/dotenv.local.template as app/.env.local and fill ID's.

  2. Run the Python server:

    a. In api, install all requirements through pip install -r requirements.txt

    b. Run the Flask app through python api.py.

  3. Run a server hosting the frontend:

    a. In app run npm run serve.