{"id":20307362,"url":"https://github.com/oktadev/okta-node-express-15-minute-auth-example","last_synced_at":"2025-04-11T15:11:25.393Z","repository":{"id":42172708,"uuid":"154897119","full_name":"oktadev/okta-node-express-15-minute-auth-example","owner":"oktadev","description":"Secure Authentication with Express and Okta","archived":false,"fork":false,"pushed_at":"2023-02-11T09:23:35.000Z","size":1301,"stargazers_count":10,"open_issues_count":6,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T11:21:24.619Z","etag":null,"topics":["auth","authentication","express","nodejs"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2019/05/31/simple-auth-express-fifteen-minutes","language":"Handlebars","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oktadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-26T21:36:59.000Z","updated_at":"2023-01-16T20:34:34.000Z","dependencies_parsed_at":"2023-02-08T14:00:49.121Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/okta-node-express-15-minute-auth-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-node-express-15-minute-auth-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-node-express-15-minute-auth-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-node-express-15-minute-auth-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-node-express-15-minute-auth-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-node-express-15-minute-auth-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429110,"owners_count":21101783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","authentication","express","nodejs"],"created_at":"2024-11-14T17:17:23.199Z","updated_at":"2025-04-11T15:11:25.360Z","avatar_url":"https://github.com/oktadev.png","language":"Handlebars","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example of Simple Authentication in Express\n\nThis is an example of a simple web site with secure user authentication that can be built in 15 minutes using Express and Okta.\n\n**Prerequisites**: [Node.js](https://nodejs.org/en/).\n\n## Getting Started\n\nTo install this example application, run the following commands:\n\n```bash\ngit clone git@github.com:oktadeveloper/okta-node-express-15-minute-auth-example.git\ncd okta-node-express-15-minute-auth-example\nnpm install\n```\n\nThis will install a local copy of the project. You will need to set up some environment variables before the app will run properly.\n\nTo integrate Okta's Identity Platform for user authentication, you'll first need to:\n\n* [Sign up for a free Okta Developer account](https://www.okta.com/developer/signup/)\n* You will get a URL similar to `https://dev-123456.oktapreview.com`.\n  * Save this URL for later\n  * You will also use this URL to login to your Okta account\n\nYou will need to create an application in Okta:\n\n* Log in to your Okta account, then navigate to **Applications** and click the **Add Application** button\n* Select **Web** and click **Next**\n* Give your application a name (e.g. \"15 Minute Auth\")\n* Change the **Base URI** to `http://localhost:3000/` and the **Login redirect URI** to `http://localhost:3000/callback`, then click **Done**\n* Save your **Client ID** and **Client Secret** for later\n\nYour Okta application should have settings similar to the following:\n\n![Okta Application Settings](images/okta-app-settings.png)\n\nYou will also need to create an API token in Okta:\n\n* Log in to your Okta account, then navigate to **API \u003e Tokens** and click the **Create Token** button\n* Enter a name that will help you remember what this is used for (e.g. \"15 Minute Auth\")\n* Save the provided **token value** for later\n  * This will only be displayed once. If you lose it, you will need to create another API token\n\nNow create a file called `.env` in the project root and add the following variables, replacing the values with your own from the previous steps.\n\n**.env**\n```bash\nHOST_URL=http://localhost:3000\nOKTA_ORG_URL=https://{yourOktaOrgUrl}\nOKTA_CLIENT_ID={yourClientId}\nOKTA_CLIENT_SECRET={yourClientSecret}\nOKTA_TOKEN={yourOktaToken}\n```\n\nYou also need an app secret. One way to get a random `APP_SECRET` is to use the following commands, which will generate a random value and add it to your `.env` file.\n\n```bash\nnpm install -g uuid-cli\necho \"APP_SECRET=`uuid`\" \u003e\u003e .env\n```\n\nNow you can run the web server with the following command:\n\n```bash\nnpm start\n```\n\n## Links\n\nThis example uses the [Okta Node SDK](https://github.com/okta/okta-sdk-nodejs) and the [Okta OIDC Middleware](https://github.com/okta/okta-oidc-js/tree/master/packages/oidc-middleware).\n\n## Help\n\nPlease [raise an issue](https://github.com/oktadeveloper/okta-node-express-15-minute-auth-example/issues) if you find a problem with the example application, or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email [developers@okta.com](mailto:developers@okta.com) if would like to create a support ticket.\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-node-express-15-minute-auth-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-node-express-15-minute-auth-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-node-express-15-minute-auth-example/lists"}