GithubHelp home page GithubHelp logo

okta / samples-js-angular Goto Github PK

View Code? Open in Web Editor NEW
72.0 85.0 146.0 2.34 MB

samples-js-angular

Home Page: https://github.com/okta/samples-js-angular

License: Other

JavaScript 17.48% HTML 18.20% TypeScript 59.69% CSS 0.25% Batchfile 0.04% Shell 4.34%

samples-js-angular's Introduction

Angular Sample Applications for Okta

This repository contains several sample applications that demonstrate various Okta use-cases in your Angular application.

Each sample makes use of the Okta Angular Library.

If you haven't done so already, register for a free account at developer.okta.com. Select Create Free Account and fill in the forms to complete the registration process. Once you are done and logged in, you will see your Okta Developer Console.

Tip: You can also create an account using the Okta CLI and okta register. To create an app, run okta apps create and use the settings below.

Register your application by selecting Applications > Add Application. On the next screen, choose Single Page App and click Next.

On the following screen, edit the application settings. For these sample applications we are using port number 8080. Configure your app as follows:

  • Base URI: http://localhost:8080
  • Login redirect URI: http://localhost:8080/login/callback
  • Logout redirect URI: http://localhost:8080

Once you have completed the form, you will be given a client ID. You will also need the issuer value for your Okta org.

The issuer is the URL of the authorization server that will perform authentication. All Developer Accounts have a "default" authorization server. The issuer is a combination of your Org URL (found in the upper right of the console home page) and /oauth2/default. For example, https://dev-133337.okta.com/oauth2/default.

These values must exist as environment variables. They can be exported in the shell, or saved in a file named testenv, located in the same directory as this README. See dotenv for more details on this file format.

ISSUER=https://yourOktaDomain.com/oauth2/default
CLIENT_ID=123xxxxx123

Please find the sample that fits your use-case from the table below.

Sample Description
Okta-Hosted Login An Angular application that will redirect the user to the Okta-Hosted login page for authentication. The user is redirected back to the Angular application after authenticating.
Custom Login Page An Angular application that uses the Okta Sign-In Widget within the Angular application to authenticate the user.

Quick Start: Automatic Setup with Heroku

You need a Heroku 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

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, you will also need to go to your Okta account to enable cors and configure the login and logout redirect URI in your client application settings for the newly deployed app domain if they are not preconfigured.

Note: Due to sample apps are served under different routes, base urls will be needed for the redirect uris, e.g.https://<myapp.heroku.com>/okta-hosted-login or https://<myapp.heroku.com>/custom-login.

Finally, click on View on the result screen to navigate to the newly deployed app.

You can use your Okta user credentials to login to the applications. 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:

npm run resource-server

Running the tests

In addition to the other environment vars, you will need credentials for a test user. Add the values for your Okta org and user in a testenv file.

ISSUER=https://yourOktaDomain.com/oauth2/default
CLIENT_ID=123xxxxx123
USERNAME[email protected]
PASSWORD=testpass

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

samples-js-angular's People

Contributors

aarongranick-okta avatar denysoblohin-okta avatar jaredperreault-okta avatar oktauploader-okta avatar robertjd avatar shuowu avatar shuowu-okta avatar sudobinbash avatar swiftone avatar vijetmahabaleshwar-okta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples-js-angular's Issues

How do you implement the clientID

I am trying to use okta hosted login authentication. Suppose my clientID is 'hdjdk688hSsn'

should I put it like this:
clientId: 'hdjdk688hSsn'

or like this within curly braces as shown in examples in the site:

clientId: '{cliendaiD}'
I.e.
clientId: '{hdjdk688hSsn}' ?

There was an unexpected internal error. Please try again. after successful login

THis is an issue reported but not followed up on by another user in Oct 2019.

Pulled the project installed it with npm, configured it for my OKTA environment. Everything starts fine and the login page is rendered properly. The user is authenticated and it shows in the logs on the OKTA server that the user was successful. But then the application it pops an error saying There was an unexpected internal error. Please try again. and leaves me at the login page.

I have this very same issue.

Mar 01 12:38:23 Raymond Walker (User) User accessing Okta admin appsuccess Raymond Walker (AppUser)
This shows I am successfully logging in to OKTA but my Website login box returns with There was an unexpected internal error. Please try again.

ANy Ideas on what could be the cause

showing issuer is undefined when deployed to aws s3

The above app is up and running fine in my local.But getting issuer is undefined error when i deployed the same in amazon s3 bucket and access the url provided when host the same.

PFA attached document for your reference.

image

image

There was an unexpected internal error. Please try again. after successful login

Pulled the project installed it with npm, configured it for my OKTA environment. Everything starts fine and the login page is rendered properly. The user is authenticated and it shows in the logs on the OKTA server that the user was successful. But then the application it pops an error saying There was an unexpected internal error. Please try again. and leaves me at the login page.

CustomLogin sample does not work

I run in root folder

  • npm run install
  • npm run build:custom-page

Got this error on second step
Node v14.18.2, npm 6.14.15

Error: node_modules/@okta/okta-auth-js/lib/idx/remediators/EnrollPoll.d.ts:23:5 - error TS2416: Property 'getValuesAfterProceed' in type 'EnrollPoll' is not assignable to the same property 
in base type 'Remediator'.
  Type '() => unknown' is not assignable to type '() => RemediationValues'.
    Type 'unknown' is not assignable to type 'RemediationValues'.

23     getValuesAfterProceed(): unknown;

404 error - page can't be found "implicit/callback"

I did not touch any part of the given code from "Okta-Hosted Login".
When ran the project with "ng serve", its all working fine.

But when generated distribution files, functionality broken and see the following issue after authentication from Okta page:

No webpage was found for the web address: http://localhost:8080/implicit/callback?code=103QSC6F_NOnVKh01pzr&state=NNDoqOHGt7iZpidooLWz7s72L4qcyJVF29E3N0isRuQnF400zHohXepOQBA0dy0b


Steps to reproduce:
Clone "https://github.com/okta/samples-js-angular/tree/master/okta-hosted-login"
Set the environment variables as given in the README.

build using -
ng build

start application with -
http-server dist


Following are my application settings on Okta:
Application type : Single Page App (SPA)
Authorization Code - YES
Implicit - NO

Login redirect URIs: http://localhost:8080/implicit/callback
Logout redirect URIs: http://localhost:8080
Login initiated by: App Only

Initiate login URI : http://localhost:8080/implicit/callback
Client authentication: Use PKCE (for public clients)

Where is process.env being set

Hi,

Any ideas where process.env is being created and set? I'm referring to the app.config.ts file.

ng serve does not work. I get an error:

An unhandled exception occurred: Environment variable ISSUER must be set.

How to setup in angualar 18 standalone components

Is there a step by step for angular 18, all standalone components. All the examples I see are for older versions of angular that rely on ngModule.
If you work from scratch and create all components using standalone you have zero ngModules in your code.
Thanks for the help.

Okta hosted sample does not work

Warning: <dependency> depends on <dependency>. CommonJS or AMD dependencies can cause optimization bailouts.

warnings

Expected behaviour

When running the custom login page example, no warnings are logged to the console

Actual behaviour

Lots of warnings are logged to the node console, the warnings all have the form <dependency> depends on <dependency>. CommonJS or AMD dependencies can cause optimization bailouts.

Output

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@giomamaladze/ng2-semantic-ui/__ivy_ngcc__/fesm2015/giomamaladze-ng2-semantic-ui.js depends on 'bowser'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@giomamaladze/ng2-semantic-ui/__ivy_ngcc__/fesm2015/giomamaladze-ng2-semantic-ui.js depends on 'date-fns/locale/en-US'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@giomamaladze/ng2-semantic-ui/__ivy_ngcc__/fesm2015/giomamaladze-ng2-semantic-ui.js depends on 'extend'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@giomamaladze/ng2-semantic-ui/__ivy_ngcc__/fesm2015/giomamaladze-ng2-semantic-ui.js depends on 'is-ua-webview'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@giomamaladze/ng2-semantic-ui/__ivy_ngcc__/fesm2015/giomamaladze-ng2-semantic-ui.js depends on 'ts-input-mask'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-auth-js/esm/browser/core/AuthStateManager.js depends on 'p-cancelable'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-auth-js/esm/browser/myaccount/types.js depends on 'cross-fetch'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-auth-js/esm/browser/myaccount/types.js depends on 'tiny-emitter'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-signin-widget/dist/esm/packages/@okta/courage-dist/esm/src/courage/util/Clipboard.js depends on 'clipboard'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-signin-widget/dist/esm/packages/@okta/courage-dist/esm/src/courage/util/jquery-wrapper.js depends on 'jquery'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-signin-widget/dist/esm/src/util/TimeUtil.js depends on '@sindresorhus/to-milliseconds'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-signin-widget/dist/esm/src/util/TimeUtil.js depends on 'parse-ms'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/@okta/okta-signin-widget/dist/esm/src/v1/controllers/EnrollDuoController.js depends on 'q'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/simon/.cache/repos/samples-js-angular/custom-login/node_modules/unload/dist/es/index.js depends on 'detect-node'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

npm ERR! ERESOLVE unable to resolve dependency tree

When trying to set up the project, it fails at npm install.

Here is what I tried:

git clone https://github.com/okta/samples-js-angular.git &&
cd samples-js-angular/custom-login &&
npm install

Output:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"~7.4.0" from the root project
npm ERR!   peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/common
npm ERR!     @angular/common@"~14.2.0" from the root project
npm ERR!     peer @angular/common@">= 6.0.0" from @giomamaladze/[email protected]
npm ERR!     node_modules/@giomamaladze/ng2-semantic-ui
npm ERR!       @giomamaladze/ng2-semantic-ui@"^1.0.1" from the root project
npm ERR!     2 more (@angular/forms, @angular/platform-browser)
npm ERR!   2 more (@angular/core, @angular/forms)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.0.0" from @giomamaladze/[email protected]
npm ERR! node_modules/@giomamaladze/ng2-semantic-ui
npm ERR!   @giomamaladze/ng2-semantic-ui@"^1.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/simon/.npm/_logs/2023-06-29T12_34_09_717Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/simon/.npm/_logs/2023-06-29T12_34_09_717Z-debug-0.log

Expected behaviour

No error in npm install.

Actual behaviour

npm install fails with an error: ERESOLVE unable to resolve dependency tree

Additional information

Node Version: 20.3.1
Npm Version: 9.6.1
OS: Ubuntu 23.04

Prod build doesn't render correctly

Trying to do a prod build of okta-hosted-login, and the compiled project doesn't appear to work. I am getting this error when I try to view the page in the browser:

Uncaught TypeError: Cannot use 'in' operator to search for 'window' in undefined

Doing ng serve works without issue.

Question: how to install "env.js" in new project?

env.js will load environment from testenv.

I am newbie and cannot find any clue how it works... how to configure it for new project? "dotenv"?

Please document few words in README and here; thanks!

Uncaught (in promise): AuthSdkError: Unable to parse a token from the url

When accessing the page 'implicit/callback' directly from the url, getting the below mentioned Error in console.

I think this error should be handdled. Is there a way that we can override or implement different OktaCallbackComponent and hanndle this kind of errors!

ERROR Error: Uncaught (in promise): OAuthError: User is not assigned to the client application.
Error
at eval (OAuthError.js:20)
at Object.../../../../@okta/okta-auth-js/lib/errors/OAuthError.js (vendor.bundle.js:134)
at webpack_require (inline.bundle.js:55)
at eval (token.js:8)
at Object.../../../../@okta/okta-auth-js/lib/token.js (vendor.bundle.js:183)
at webpack_require (inline.bundle.js:55)
at eval (clientBuilder.js:23)
at Object.../../../../@okta/okta-auth-js/lib/clientBuilder.js (vendor.bundle.js:85)
at webpack_require (inline.bundle.js:55)
at eval (index.js:2)
at eval (OAuthError.js:20)
at Object.../../../../@okta/okta-auth-js/lib/errors/OAuthError.js (vendor.bundle.js:134)
at webpack_require (inline.bundle.js:55)
at eval (token.js:8)
at Object.../../../../@okta/okta-auth-js/lib/token.js (vendor.bundle.js:183)
at webpack_require (inline.bundle.js:55)
at eval (clientBuilder.js:23)
at Object.../../../../@okta/okta-auth-js/lib/clientBuilder.js (vendor.bundle.js:85)
at webpack_require (inline.bundle.js:55)
at eval (index.js:2)
at resolvePromise (zone.js:809)
at eval (zone.js:728)
at rejected (okta.service.js:24)
at ZoneDelegate.invoke (zone.js:388)
at Object.onInvoke (core.js:4749)
at ZoneDelegate.invoke (zone.js:387)
at Zone.run (zone.js:138)
at eval (zone.js:858)
at ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4740)

Need okta angular code for the version 10

Hi Team,

My current application runs with angular version 10.
Kindly provide the okta integration code for this version or if the code is available, please provide the repo details.
Thanks in advance.

Thanks,
Raja.

Samples won't build using enableIvy: true

Editing the tsconfig.json setting angularCompilerOptions enableIvy to true:

{
"compileOnSave": false,
"angularCompilerOptions": {
"enableIvy": true
},
"compilerOptions": {
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"module": "esnext",
"baseUrl": "./"
}
}

Then runing ng build --prod or ng serve -o results in the following:

ERROR in There is no format with import statements in 'C:/Users/dcurrotto/source/repos/samples-js-angular/custom-login/node_modules/@okta/okta-angular' entry-point.

CORS Issue on production server, this example is working fine on local dev server

Access to XMLHttpRequest at 'https://mydomain-qa.oktapreview.com/oauth2/default/v1/userinfo' from origin 'http://:4443' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

When I run it on local dev environment, okta-hosted-login example is working fine, but not on production server. It is running into this issue when I try to use the same code from here and replace it with my host and change my redirect uri to myhost from localhost. Can someone help me with this?

Okta config:
export default { oidc: { clientId: '<myclientid', issuer: 'https://mydomain-qa.oktapreview.com/oauth2/default', redirectUri: 'http://<myhost>:4443/implicit/callback', scope: 'openid profile email', testing: { disableHttpsCheck: false } }, resourceServer: { messagesUrl: 'http://<myhost>:4443/api/messages', }, };
Config on okta ui:
Login redirect URIs : http://myhost:4443/implicit/callback
Browser: Chrome Version 73.0.3683.103 (Official Build) (64-bit)
OS: macOS Mojave

Error when attempting to login

Running Windows 10

Today, 08-01-2021:

  1. Logged into my developer.okta.com account (dev-okta-domain)
  2. Added "http://localhost:8080/" as a Trusted Origin URL
  3. Created an application:
    Client ID: client-id
    Client authentication: Use PKCE
    Application Type: Single Page App (SPA)
    Grant Type: Authorization Code,
    User Consent: Require consent
  4. Opened a Powershell 7.1.3 session
  5. cd srcdir
  6. git clone https://github.com/okta/samples-js-angular.git
  7. cd to srcdir\samples-js-angular
  8. Created a testenv file with ISSUER and CLIENT_ID:
    ISSUER=https://dev-`okta-domain`.com/oauth2/default
    CLIENT_ID=client-id
  9. cd to srcdir\samples-js-angular\custom-login
  10. npm install -> installed successfully
  11. npm run start -> started successfully
  12. Opened an incognito window in chrome browser
  13. Entered the URL: http://localhost:8080/ -> the home page appeared
  14. Clicked the Login button -> browser loaded http://localhost:8080/login successfully
  15. Opened Developer Tools Console
  16. Entered my credentials
  17. Clicked the Login button -> Got the following error message in the console:

POST https://dev-`okta-domain`.com/api/v1/authn net::ERR_NAME_NOT_RESOLVED zone-evergreen.js:1068

executing "let resultPromise = fn.apply(this, arguments);" :

    function zoneify(fn) {
        return function () {
            let resultPromise = fn.apply(this, arguments);
            if (resultPromise instanceof ZoneAwarePromise) {
                return resultPromise;
            }
            let ctor = resultPromise.constructor;
            if (!ctor[symbolThenPatched]) {
                patchThen(ctor);
            }
            return resultPromise;
        };
    }

What could be the issue?

E401 - Unable to authenticate when running npm install

I am trying to get the sample angular app to run on my macOS (10.15.4) and am receiving the following error when attempting to run npm install

โžœ  samples-js-angular git:(master) npm install
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"

I was able to work around the issue by running npm install --registry https://registry.npmjs.org, per the recommendation from zowe/zowe-cli#377 but still wanted to raise the issue incase others run into the same.

2020-05-21T19_09_42_802Z-debug.log

Uncaught (in promise): OAuthError: User is not assigned to the client application

I am using the OKta hosted login.

How do I catch the error on 'implicit/callback' route.
When the unassinged user(User - not assigned people list for the application) try to login, it redirects to the blank page: "implicit/callback" with the following error in console.

core.js:1601 ERROR Error: Uncaught (in promise): OAuthError: User is not assigned to the client application.
Error
at Object../node_modules/@okta/okta-auth-js/lib/errors/OAuthError.js (OAuthError.js:20)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/token.js (token.js:21)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/clientBuilder.js (clientBuilder.js:23)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/reqwest/index.js (index.js:15)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/index.js (index.js:15)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/errors/OAuthError.js (OAuthError.js:20)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/token.js (token.js:21)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/clientBuilder.js (clientBuilder.js:23)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/reqwest/index.js (index.js:15)
at webpack_require (bootstrap:81)
at Object../node_modules/@okta/okta-auth-js/lib/index.js (index.js:15)
at webpack_require (bootstrap:81)
at resolvePromise (zone.js:783)
at zone.js:709
at rejected (okta.service.js:24)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Object.onInvoke (core.js:4071)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:141)
at zone.js:831
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:424)
at Object.onInvokeTask (core.js:4062)

testenv issue

I am following the documentation and have created a testenv file in the same directory as the README file.
I've tried pasting in our correct values, but I get the error below. Finally, I just copied the code from the README and pasted into:

ISSUER=https://yourOktaDomain.com/oauth2/default
CLIENT_ID=123xxxxx123
USERNAME=testuser
PASSWORD=testpass

Yet I get this error after running ng serve:

An unhandled exception occurred: Environment variable ISSUER must be set. See README.md

Not sure what I am doing wrong.

15 rules skipped due to selector errors: .ui.top.attached.label+[class*="right floated"]+* -> Cannot read properties of undefined (reading 'type')

login-page

Expected Behaviour

When running the custom login page example, no warning is shown in the console.

Actual Behaviour

This warning is logged to the console:

polyfills.js:1 [webpack-dev-server] WARNING
15 rules skipped due to selector errors:
  .ui.top.attached.label+[class*="right floated"]+* -> Cannot read properties of undefined (reading 'type')
  .ui.top.attached.label+:not(.attached) -> Cannot read properties of undefined (reading 'type')
  .ui.modal>.icon+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox h2+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox h3+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox li+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox ol+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox p+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox ul+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact h2+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact h3+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact li+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact ol+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact p+* -> Cannot read properties of undefined (reading 'type')
  #okta-sign-in .infobox-compact ul+* -> Cannot read properties of undefined (reading 'type')

How can I get refresh token ?

I am using Custom Login page that uses the Okta Sign-In Widget within the Angular application to authenticate the user, I am successfully able to authenticate and getting access token and Id token. But I want to know how can get refresh token to get updated access token if current access token got expire. Please guide me.
Thanks

Angular SPA - Logout Uri Redirection post token expiry (timeout) does not work

Hi,

I am running the sample Okta Hosted Login with logout redirect uri. For that I followed all the steps provided at the following url:
https://developer.okta.com/docs/guides/sign-users-out/angular/sign-out-of-okta/

I added a logout component to the SPA application which is not there in the Okta Hosted Login sample example and added the code given at the above link in it. Also added the angular routing for the logout route and configured http://localhost:8080/logout rule in Okta against the SPA. Tested the logout route in the browser and it works as expected however after the access token times out the application is not redirected to /logout uri configured in Okta SPA. Access token timeout is set up to 5 min in the access policy rule and refresh token is setup with unlimited refreshes with 7 days of expiry if not used. After 5 min of timeout if I click on some other link in the application (say profile or messages) then it refreshes the token so there is no issue with the timeout config as I can see. However we want user to be redirected to logout page if there is no activity by user for 5 min (i.e. when the access token expires)

We have integrated Okta with our other ASP.Net MVC application and there logout redirection works flawlessly however for angular SPA application it does not seem to be working

I am using your code sample (Okta Hosted Login code sample) for reproducing this issue as mentioned above

Ready to share my logout component if you want though there is nothing special about it

Thanks in advance for acknowledging the issue

Thanks,
Amit Kale

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.