npm
, yarn
, or pnpm
.
+ - A favorite text editor or IDE
+source_code: Asgardeo Node.js Sample
+whats_next:
+ # - Try out {{ product_name }} complete React guide
+ # - Try out {{product_name}} user onboarding complete guide for React
+ # - Read security best practices for React app guide
+---
+## Configure an Application in {{ product_name }}
+
+- Sign into {{ product_name }} console and navigate to **Applications > New Application.**
+- Select **Traditional Web Application** and complete the wizard popup by providing a suitable name and an authorized redirect URL. (*Ensure that the protocol remains set to OpenID Connect (OIDC).)*
+
+!!! Example
+ Name : asgardeo-nodejs
+
+ Authorized redirect URL: http://localhost:3000/oauth2/redirect, http://localhost:3000/
+
+
+
+!!! Info
+
+ The authorized redirect URL determines where {{product_name}} should send users after they successfully log in. Typically, this will be the web address where your app is hosted. For this guide, we'll use `http://localhost:3000/oauth2/redirect` and http://localhost:3000 as the authorized redirect URL. The http://localhost:3000/ URL is used to redirect the user after logging out.
+
+
+
+Make a note of the following values from the **Protocol** tab of the registered application. You will need them during the **Step 4**
+
+- **`client-id`** from the **Protocol** tab.
+- **`client-secret`** from the **Protocol** tab.
+- **The name of your Asgardeo organization**
+
+
+## Create a Node.js app
+
+Create your new Node.js app using npx `express-generator` command.
+
+=== "npm"
+
+ ```bash
+ npx express-generator asgardeo-nodejs --view=ejs
+
+ cd asgardeo-nodejs
+
+ npm install
+
+ npm start
+ ```
+
+=== "yarn"
+
+ ```bash
+ yarn dlx express-generator asgardeo-nodejs --view=ejs
+
+ cd asgardeo-nodejs
+
+ yarn install
+
+ yarn start
+ ```
+
+=== "pnpm"
+
+ ```bash
+ pnpm dlx express-generator asgardeo-nodejs --view=ejs
+
+ cd asgardeo-nodejs
+
+ pnpm install
+
+ pnpm start
+ ```
+
+Navigate to [http://localhost:3000](http://localhost:3000){:target="_blank"} and you should see the sample app working in the browser.
+
+## Install @asgardeo/passport-asgardeo
+
+Passport Asgardeo strategy is a Passport strategy that allows you to authenticate using {{product_name}}. To get started, simply add the Passport Asgardeo strategy to the project together with the other required dependencies. Make sure to stop the dev server started in the previous step.
+
+=== "npm"
+
+ ```bash
+ npm install passport express-session dotenv @asgardeo/passport-asgardeo
+
+ ```
+
+=== "yarn"
+
+ ```bash
+ yarn add passport express-session dotenv @asgardeo/passport-asgardeo
+
+ ```
+
+=== "pnpm"
+
+ ```bash
+ pnpm add passport express-session dotenv @asgardeo/passport-asgardeo
+
+ ```
+
+## Configure Passport Asgardeo
+
+Create `.env` environment properties file, and add the following variables:
+
+```bash
+ASGARDEO_ORGANISATION=Welcome to <%= title %>
+ <% if (locals.user) { %> +Welcome to <%= title %>
+ <% if (locals.user) { %> +Hello <%= user.username %>
+