{"id":13452106,"url":"https://github.com/oktadev/okta-vanilla-js-example","last_synced_at":"2025-04-11T15:10:29.206Z","repository":{"id":44885384,"uuid":"136120856","full_name":"oktadev/okta-vanilla-js-example","owner":"oktadev","description":"A Vanilla JavaScript App with Authentication","archived":false,"fork":false,"pushed_at":"2022-01-20T14:14:57.000Z","size":29,"stargazers_count":15,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-05T11:12:10.538Z","etag":null,"topics":["authentication","express","javascript","nodejs"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2018/06/05/authentication-vanilla-js","language":"JavaScript","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-06-05T04:43:59.000Z","updated_at":"2024-08-03T11:59:41.000Z","dependencies_parsed_at":"2022-09-11T02:50:48.002Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/okta-vanilla-js-example","commit_stats":null,"previous_names":["oktadeveloper/okta-vanilla-js-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-vanilla-js-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-vanilla-js-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-vanilla-js-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-vanilla-js-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-vanilla-js-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429104,"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":["authentication","express","javascript","nodejs"],"created_at":"2024-07-31T07:01:13.138Z","updated_at":"2025-04-11T15:10:29.189Z","avatar_url":"https://github.com/oktadev.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# A Vanilla JavaScript App with Authentication\n\nThis example app shows how to use Vanilla JavaScript to build an app and add authentication with Okta.\n\nPlease read [Add Authentication to Your Vanilla JavaScript App in 20 Minutes](https://developer.okta.com/blog/2018/06/05/authentication-vanilla-js) to see how this app was created.\n\n**Prerequisites:** [Node.js](https://nodejs.org/).\n\n\u003e [Okta](https://developer.okta.com/) has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application.\n\n* [Getting Started](#getting-started)\n* [Links](#links)\n* [Help](#help)\n* [License](#license)\n\n## Getting Started\n\nTo install this example application, run the following commands:\n\n```bash\ngit clone https://github.com/oktadeveloper/okta-vanilla-js-example.git\ncd okta-vanilla-js-example\n```\n\nThis will get a copy of the project installed locally. To install all of its dependencies and start the app, follow the instructions below.\n \n```bash\nnpm install\nnode .\n```\n\n### Setup Okta\n\nLog in to your Okta Developer account (or [sign up](https://developer.okta.com/signup/) if you don’t have an account) and navigate to **Applications** \u003e **Add Application**. Click **Single-Page App**, click **Next**, and give the app a name you’ll remember. Click **Done**.\n\n#### Server Configuration\n\nOpen `index.js` and replace `{YOUR_OKTA_DOMAIN}` in the following code block. \n\n```js\nconst oktaJwtVerifier = new OktaJwtVerifier({\n  issuer: 'https://{YOUR_OKTA_DOMAIN}/oauth2/default'\n})\n```\n\n**NOTE:** The value of `{YOUR_OKTA_DOMAIN}` should be something like `dev-123456.oktapreview.com`. Make sure you don't include `-admin` in the value!\n\n#### Client Configuration\n\nFor the client, set the `baseUrl`, `clientId`, and `authParams.issuer` in `public/main.js`.\n\n```js\nthis.signIn = new OktaSignIn({\n  baseUrl: 'https://{yourOktaDomain}',\n  clientId: '{clientId}',\n  redirectUri: 'http://localhost:8080',\n  authParams: {\n    issuer: 'https://{yourOktaDomain}/oauth2/default',\n    pkce: false,\n    responseType: ['id_token','token']\n  },\n  logo: '//placehold.it/200x40?text=Your+Logo',\n  i18n: {\n    en: {\n      'primaryauth.title': 'Sign in to Calorie Tracker'\n    }\n  }\n})\n```\n\n## Links\n\nThis example uses the following libraries provided by Okta:\n\n* [Okta JWT Verifier](https://github.com/okta/okta-oidc-js/tree/master/packages/jwt-verifier)\n* [Okta Sign-In Widget](https://github.com/okta/okta-signin-widget)\n\n## Help\n\nPlease post any questions as comments on the [blog post](https://developer.okta.com/blog/2018/06/05/authentication-vanilla-js), or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email 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-vanilla-js-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-vanilla-js-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-vanilla-js-example/lists"}