Skip to content

Commit bdbdef2

Browse files
Changes for Heroku integration
1 parent ea3e39e commit bdbdef2

File tree

5 files changed

+76
-2
lines changed

5 files changed

+76
-2
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ Please find the sample that fits your use-case from the table below.
3636

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

39+
## Quick Start: Automatic Setup with Heroku
40+
41+
You need a [Heroku](https://signup.heroku.com/) account to follow these instructions.
42+
43+
You can create a free Okta Developer org and deploy this app directly to Heroku by clicking the purple button:
44+
45+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
46+
47+
To deploy the app, you will need an Okta org setup as described in the section above.
48+
49+
You will also need to replace the config values for `ISSUER` and `CLIENT_ID` in Heroku configuration based on your Okta org.
50+
Also be sure to add your Heroku app's base URL to the list of trusted origins in your Okta admin settings.
51+
52+
After you deploy the app, click on **View** on the result screen to navigate to the newly deployed app.
53+
54+
Click **Login** button on the app. Browser displays the sign-in page to authenticate.
55+
56+
You can use your Okta user credentials to login to the application. That's it! You've successfully logged in using Okta.
57+
3958
## Running the resource server
4059
The samples include a page which accesses a protected resource (messages). To start the sample resource server:
4160

@@ -55,3 +74,4 @@ PASSWORD=testpass
5574
```
5675

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

app.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Custom Login Sample",
3+
"description": "Sample that demonstrates use of Custom Login/Embedded Sign-in Widget",
4+
"repository": "https://github.com/okta/samples-js-vue/custom-login",
5+
"keywords": ["oidc", "identity", "security", "authentication"],
6+
"success_url": "/",
7+
"env": {
8+
"ISSUER": {
9+
"description": "Issuer URL for your org",
10+
"value": "https://qa-st-cda1.oktapreview.com/oauth2/default"
11+
},
12+
"CLIENT_ID": {
13+
"description": "Client ID for your application",
14+
"value": "0oa1mb3urzAsFdkNc0x7"
15+
},
16+
"NPM_CONFIG_PRODUCTION": {
17+
"description": "npm config production",
18+
"value": "false"
19+
},
20+
"OKTA_TESTING_DISABLEHTTPSCHECK": {
21+
"description": "Okta test disable https check",
22+
"value": "false"
23+
},
24+
"USE_INTERACTION_CODE": {
25+
"description": "Use interaction code flow",
26+
"value": "true"
27+
},
28+
"YARN_PRODUCTION": {
29+
"description": "Yarn production",
30+
"value": "false"
31+
}
32+
}
33+
}

custom-login/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"scripts": {
66
"ng": "ng",
7-
"start": "ng serve",
7+
"start": "node server.js",
88
"build": "ng build --prod",
99
"test": "npm run lint && npm run test:custom-login --prefix ../",
1010
"lint": "ng lint"

custom-login/server.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const express = require('express');
2+
const serveStatic = require("serve-static");
3+
const path = require('path');
4+
5+
const app = express();
6+
7+
//here we are configuring dist to serve app files
8+
app.use("/", serveStatic(path.join(__dirname, "/dist")));
9+
10+
// this * route is to serve project on different page routes except root `/`
11+
app.get(/.*/, function(req, res) {
12+
res.sendFile(path.join(__dirname, "/dist/index.html"));
13+
});
14+
15+
const port = process.env.PORT || 8080;
16+
app.listen(port);
17+
console.log(`app is listening on port: ${port}`);

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
"setup-env": "node scripts/setup-env.js",
2121
"install-custom-login": "cd custom-login && npm install",
2222
"install-okta-hosted-login": "cd okta-hosted-login && npm install",
23-
"webdriver-update-legacy": "webdriver-manager update --versions.standalone=3.141.59 --versions.chrome 2.45 --gecko false"
23+
"webdriver-update-legacy": "webdriver-manager update --versions.standalone=3.141.59 --versions.chrome 2.45 --gecko false",
24+
25+
"start": "npm run --prefix custom-login start",
26+
"serve": "npm run --prefix custom-login serve",
27+
"build": "npm run --prefix custom-login build"
2428
},
2529
"author": "",
2630
"license": "Apache-2.0",

0 commit comments

Comments
 (0)