Skip to content

Coffee Shop for students to order drinks using auth0

Notifications You must be signed in to change notification settings

shrutikumar15/Coffee-Shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Coffee Shop Full Stack

Full Stack Nano - IAM Final Project

Udacity has decided to open a new digitally enabled cafe for students to order drinks, socialize, and study hard. But they need help setting up their menu experience.

The application:

  1. Display graphics representing the ratios of ingredients in each drink.
  2. Allow public users to view drink names and graphics.
  3. Allow the shop baristas to see the recipe information.
  4. Allow the shop managers to create new drinks and edit existing drinks.

Getting Started

Installing Dependencies

Python 3.7

Follow instructions to install the latest version of python for your platform in the python docs

Virtual Enviornment

We recommend working within a virtual environment whenever using Python for projects. This keeps your dependencies for each project separate and organaized. Instructions for setting up a virual enviornment for your platform can be found in the python docs

PIP Dependencies

Once you have your virtual environment setup and running, install dependencies by naviging to the /backend directory and running:

pip install -r requirements.txt

This will install all of the required packages we selected within the requirements.txt file.

ionic serve
Key Dependencies
  • Flask is a lightweight backend microservices framework. Flask is required to handle requests and responses.

  • SQLAlchemy and Flask-SQLAlchemy are libraries to handle the lightweight sqlite database. Since we want you to focus on auth, we handle the heavy lift for you in ./src/database/models.py. We recommend skimming this code first so you know how to interface with the Drink model.

  • jose JavaScript Object Signing and Encryption for JWTs. Useful for encoding, decoding, and verifying JWTS.

Running the server

From within the ./src directory first ensure you are working using your created virtual environment.

Each time you open a new terminal session, run:

export FLASK_APP=api.py;

To run the server, execute:

flask run --reload

The --reload flag will detect file changes and restart the server automatically.

Tasks

Setup Auth0

  1. Create a new Auth0 Account
  2. Select a unique tenant domain
  3. Create a new, single page web application
  4. Create a new API
    • in API Settings:
      • Enable RBAC
      • Enable Add Permissions in the Access Token
  5. Create new API permissions:
    • get:drinks-detail
    • post:drinks
    • patch:drinks
    • delete:drinks
  6. Create new roles for:
    • Barista
      • can get:drinks-detail
    • Manager
      • can perform all actions
  7. Test your endpoints with Postman.
    • Register 2 users - assign the Barista role to one and Manager role to the other.
    • Sign into each account and make note of the JWT.
    • Import the postman collection ./starter_code/backend/udacity-fsnd-udaspicelatte.postman_collection.json
    • Right-clicking the collection folder for barista and manager, navigate to the authorization tab, and including the JWT in the token field (you should have noted these JWTs).
    • Run the collection and correct any errors.
    • Export the collection overwriting the one we've included so that we have your proper JWTs during review!

Implement The Server

There are @TODO comments throughout the ./backend/src. We recommend tackling the files in order and from top to bottom:

  1. ./src/auth/auth.py
  2. ./src/api.py

2020-06-02 11_44_50-Mail

2020-06-02 11_45_14-

2020-06-02 11_45_29-Mail

2020-06-02 01_46_39-Mail

About

Coffee Shop for students to order drinks using auth0

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published