/samples-nodejs-express-4

Express 4 samples. Will publish an artifact that can be consumed by end-to-end sample repos

Primary LanguageHTMLOtherNOASSERTION

Express Sample Applications for Okta

This repository contains several sample applications that show you how to integrate various Okta use-cases into your Node.js application that uses the Express framework.

Please find the sample that fits your use-case from the table below.

Sample Description Use-Case
Okta-Hosted Login An application server that uses the hosted login page on your Okta org, then creates a cookie session for the user in the Express application. Traditional web applications with server-side rendered pages.
Custom Login Page An application server that uses the Okta Sign-In Widget on a custom login page within the application, then creates a cookie session for the user in the Express application. Traditional web applications with server-side rendered pages.
Resource Server This is a sample API resource server that shows you how to authenticate requests with access tokens that have been issued by Okta. Single-Page applications.

Running E2E Tests locally

E2E Tests will be run against the Custom Login and Okta-Hosted Login servers

Before running the tests locally, install all the dependencies

npm install

Then you need to setup the following environment variables

export CLIENT_ID={yourAppClientId}
export CLIENT_SECRET={yourAppClientSecret}
export OKTA_DOMAIN={yourOktaOrgDomain}

NOTE: Use only the domain part of your org url while setting OKTA_DOMAIN environment.

After setting up the environment variables, you need to run a script to update the configuration

sh scripts/update-samples-config.sh

A final step is update the following environment variables with username & password of the user you want to use in your tests

Note that the USERNAME should be of the form "username@email.com"

export USERNAME={userName}
export PASSWORD={password}

Then run the E2E tests:

npm test