GithubHelp home page GithubHelp logo

isabella232 / okta-node-heroku-app-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oktadev/okta-node-heroku-app-example

0.0 0.0 0.0 14 KB

A sample Node.js app that you can deploy to Heroku.

License: Apache License 2.0

JavaScript 69.23% CSS 1.84% Pug 28.94%

okta-node-heroku-app-example's Introduction

Okta Node Heroku App Example

This repository shows you how to use Okta in a Node.js application and how to deploy the application to Heroku. Please read Build and Deploy a Node.js App to Heroku to see how it was created.

Prerequisites:

Getting Started

To run this example locally, run the following commands:

git clone https://github.com/oktadev/okta-node-heroku-app-example.git
cd okta-node-heroku-app-example

Create an OIDC Application in Okta

Create a free developer account with the following command using the Okta CLI:

okta register

If you already have a developer account, use okta login to integrate it with the Okta CLI.

Provide the required information. Once you register, create a client application in Okta with the following command:

okta apps create

You will be prompted to select the following options:

  • Type of Application: 1: Web
  • Framework of Application: Other
  • Redirect URI: http://localhost:3000/authorization-code/callback
  • Post Logout Redirect URI: http://localhost:3000

The application configuration will be printed to .okta.env.

export OKTA_OAUTH2_ISSUER="{yourOktaDomain}/oauth2/default"
export OKTA_OAUTH2_CLIENT_SECRET="{yourClientSecret}"
export OKTA_OAUTH2_CLIENT_ID="{yourClientId}"

Open .okta.env and add the following to the end of your file after your Okta configuration values:

export APP_BASEURL="http://localhost:3000"

Install dependencies and run the app

To install the dependencies and start the app, run the following commands:

npm install
npm start

Publish to Heroku

Push the code to your GitHub repository. Navigate to your Heroku dashboard. Click on New and then Create new app. Give you app a distinct name and then click Create app. In the app page, under Deploy, select Deployment Method GitHub.

Connect your GitHub account to Heroku. Click Enable Automatic Deploys. Click Deploy Branch under Manual Deploy for your first time deploy. Under the Settings tab, find the Domains section. Make note of your domain.

Under Config Vars click Reveal Config Vars and add the values for APP_BASEURL, which will be the URL you just noted.

`OKTA_OAUTH2_CLIENT_ID` = {yourClientId}
`OKTA_OAUTH2_CLIENT_SECRET` = {yourClientSecret}
`OKTA_OAUTH2_ISSUER` = {yourOktaDomain}/oauth2/default

Finish Okta Setup

Navigate back to your Okta dashboard

Find the application you created for this project and click Edit under General Settings

Under Login, find the setting for Sign-in redirect URIs and add the value for your app's base domain + /authorization-code/callback. It should look something like this: https://okta-heroku-webapp-nfisher.herokuapp.com/authorization-code/callback

Under signout redirect, add a value for your applications domain. It should look something like this: https://okta-heroku-webapp-nfisher.herokuapp.com

Navigate to your application, you should see the home page. Try to login and see your profile.

Links

This example uses the following open source libraries from Okta:

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums.

License

Apache 2.0, see LICENSE.

okta-node-heroku-app-example's People

Contributors

nickolasfisher avatar tanay1337 avatar

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.