Git Product home page Git Product logo

labs-node-working-with-apis's Introduction

Auth0 Training

Lab Node Working with APIs

In this hands-on lab, learners will put their API knowledge into practice by creating an API in their Auth0 tenant, deploying a test API into the lab environment, obtaining a test Access Token, and calling the test API using the token.

Requirements

  1. A GitHub account: Our labs use GitHub Codespaces, so you'll need a GitHub account to access them. Create a free account here.
  2. An Auth0 account: You'll also need an Auth0 account. If you do not already have one, you can create a free one here.

Accessing and Working with Auth0 Labs

  1. Fork this lab repo to your GitHub account: Click the "Fork" button located in the top right corner of the GitHub page. On the resulting page, under "Owner," select the dropdown menu and choose yourself as the owner for the forked repository. Then click the “Create fork” button. After a moment or two, you'll land on your fork of the repository. This fork now belongs to you, and you can revisit it later at any time.
  2. Open the lab repo in a Codespace: From the “Code” dropdown menu, toggle to the Codespaces tab. Click the plus sign to create and open the lab in a Codespace. A new tab will open, and Codespaces will begin configuring the lab environment. Wait for the environment to finish building.
  3. Begin working with the lab: Once the environment is ready you'll see a Codetour popup with instructions for connecting the lab to your Auth0 account. This can take some time, as the environment is installing several plugins to facilitate the lab. Once it is complete, you can open the Codetour to view all steps using the panel in the lower right. Follow the lab instructions (clicking to configure, selecting next, inserting code, etc.) in order to complete the lab.
  4. If you'd like to save your work to your forked lab repo: You can commit and push your changes to your fork (See: Using Source Control in Your Codespace).
  5. IMPORTANT: Close the Codespace when you're finished with the lab: Codespaces come with a set amount of free usage. To avoid using all of your free use allocation, be sure to return to the forked repo, select the "Code" dropdown, select the dots next to your open Codespace, and select "Delete." This will not delete your forked repository. You can keep that forever, and open a new Codespace whenever you like.

What is Auth0?


Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • Add support for linking different user accounts with the same user.
  • Support for generating signed JSON Web Tokens to call your APIs and flow the user identity securely.
  • Analytics of how, when, and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.

Issue Reporting


If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

Author


Auth0

License


This project is licensed under the MIT license. See the LICENSE file for more info.

labs-node-working-with-apis's People

Contributors

eemanioui avatar jespookta avatar jesposito avatar kateharney avatar kazemicode avatar notmyself avatar xijing-zhang avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

labs-node-working-with-apis's Issues

Duplicate `/expenses` route

Hi Team,

At Step #5 of 7 (2: Configure the Web Application to Pull Expenses from the API) the instruction is to:

Modify the Expenses Route

Now we'll modify the "/expenses" route in a similar way. Compare the block below to what's currently in the code. As before, we're adding error handling, and defining the path to the relevant data in our Expenses API.

app.get("/expenses", requiresAuth(), async (req, res, next) => {
    try {
        const expenses = await axios.get(`${API_URL}/reports`);
        res.render("expenses", {
           user: req.oidc && req.oidc.user,
           expenses: expenses.data,
        });
    } catch (err) {
        next(err);
    }
});

Insert Code , then continue to the next step.


However, this ends up replacing the user endpoint handler instead as it is highlighted by default:
wrong highlighted section

Please Note, I didn't highlight the /user endpoint handler in the above screenshot, it was highlight by default.

After clicking on insert code, the /user endpoint handler is replaced by the new /expenses Get handler and we end up with 2 handlers for the same GET route, like so:
duplicate routes

I even deleted the codespace lab and restarted it again and this time, I highlighted the /expenses endpoint to be replaced. However, the issue still persisted by replacing the user endpoint instead.
doesn't work even when the right endpoint is highlighted

Failure in Opening Auth0 Extension Through CLI

Description

image

When I click the hyperlink at the second point, I do not receive any feedback. I expect Auth0 extension (if any) opens and view my tenant configuration.

Reproduction

Go to step 2 of 2 of the code tour. Click the hyperlink at the first point, then the one at the second point.

Environment

Please provide the following:

  • Version of this library used: 1.1.1
  • Version of the platform or framework used, if applicable:
  • Other relevant versions (language, server software, OS, browser):
  • Other modules/plugins/libraries that might be involved:

inconsistent values

Hi Team,

As I was going through the lab under this repo and after going through the labs under this repo I couldn't help but notice a difference when it comes to handling the response_type field within the authorizationParams object that's passed as an argument to the auth middleware.

In the lab under this repo, a value of "code" is assigned to it:
image
In the labs under this repo, a value of "code id_token" is assigned to it:
image

While the value assigned to the response_type field differs from one lab to the other, both of them deal with a regular Web App that requires the Authorization Code Workflow and both of them work. My questions:

Is there any side effect to using "code" over "code id_token" or vice versa?
Which one is recommended as best practice?

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.