Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for Heroku integration #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ Please find the sample that fits your use-case from the table below.

[Okta Angular Library]: https://github.com/okta/okta-oidc-js/tree/master/packages/okta-angular

## Quick Start: Automatic Setup with Heroku

You need a [Heroku](https://signup.heroku.com/) account to follow these instructions.

You can create a free Okta Developer org and deploy this app directly to Heroku by clicking the purple button:

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

To deploy the app, you will need an Okta org setup as described in the section above.

You will also need to replace the config values for `ISSUER` and `CLIENT_ID` in Heroku configuration based on your Okta org.
Also be sure to add your Heroku app's base URL to the list of trusted origins in your Okta admin settings.

After you deploy the app, click on **View** on the result screen to navigate to the newly deployed app.

Click **Login** button on the app. Browser displays the sign-in page to authenticate.

You can use your Okta user credentials to login to the application. That's it! You've successfully logged in using Okta.

## Running the resource server
The samples include a page which accesses a protected resource (messages). To start the sample resource server:

Expand All @@ -55,3 +74,4 @@ PASSWORD=testpass
```

With these variables set, you should be able to run `npm test` and bask in the glory of passing tests.

33 changes: 33 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "Custom Login Sample",
"description": "Sample that demonstrates use of Custom Login/Embedded Sign-in Widget",
"repository": "https://github.com/okta/samples-js-vue/custom-login",
"keywords": ["oidc", "identity", "security", "authentication"],
"success_url": "/",
"env": {
"ISSUER": {
"description": "Issuer URL for your org",
"value": "https://qa-st-cda1.oktapreview.com/oauth2/default"
},
"CLIENT_ID": {
"description": "Client ID for your application",
"value": "0oa1mb3urzAsFdkNc0x7"
},
"NPM_CONFIG_PRODUCTION": {
"description": "npm config production",
"value": "false"
},
"OKTA_TESTING_DISABLEHTTPSCHECK": {
"description": "Okta test disable https check",
"value": "false"
},
"USE_INTERACTION_CODE": {
"description": "Use interaction code flow",
"value": "true"
},
"YARN_PRODUCTION": {
"description": "Yarn production",
"value": "false"
}
}
}
2 changes: 1 addition & 1 deletion custom-login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "node server.js",
"build": "ng build --prod",
"test": "npm run lint && npm run test:custom-login --prefix ../",
"lint": "ng lint"
Expand Down
17 changes: 17 additions & 0 deletions custom-login/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const express = require('express');
const serveStatic = require("serve-static");
const path = require('path');

const app = express();

//here we are configuring dist to serve app files
app.use("/", serveStatic(path.join(__dirname, "/dist")));

// this * route is to serve project on different page routes except root `/`
app.get(/.*/, function(req, res) {
res.sendFile(path.join(__dirname, "/dist/index.html"));
});

const port = process.env.PORT || 8080;
app.listen(port);
console.log(`app is listening on port: ${port}`);
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
"setup-env": "node scripts/setup-env.js",
"install-custom-login": "cd custom-login && npm install",
"install-okta-hosted-login": "cd okta-hosted-login && npm install",
"webdriver-update-legacy": "webdriver-manager update --versions.standalone=3.141.59 --versions.chrome 2.45 --gecko false"
"webdriver-update-legacy": "webdriver-manager update --versions.standalone=3.141.59 --versions.chrome 2.45 --gecko false",

"start": "npm run --prefix custom-login start",
"serve": "npm run --prefix custom-login serve",
"build": "npm run --prefix custom-login build"
},
"author": "",
"license": "Apache-2.0",
Expand Down