How I get okta live site session in my application?

Hello ,

I implemented Okta in my angular5 application using “OpenID Connect Client”. I created a custom form for login and fill username and password.
I implemented it from your blog https://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc with custom form.

I have few problem with Okta session. I need that If I logged-in with live Okta website “https://dev-979342.oktapreview.com” and open my application link in new tab with same browser than my application should be auto logged-in with the current session of live Okta and vice-versa for logout. please see attached screen-shot.

Please send me solution what I am looking for.

Thanks

This will work automatically if you redirect to the /authorize route (start your login process) and you already have an Okta session. Instead of displaying the login page, the browser will immediately be redirect back to your app and you will be signed in.

I coded for it with session exist. Please see my following code

async handleAuthenticationOKta(){
        this.oktaAuth.session.exists() 
            .then(function(exists) {
            if (exists) {
                console.log("logged in");
                this.oktaAuth.token.parseFromUrl()
  .then(idToken => {
    console.log(`hi ${idToken.claims.email}!`);
    this.oktaAuth.tokenManager.add('idToken', idToken);
  })
            } else {
                console.log("not logged in");
               this.logout();
            }
        });
    }

this code print only “logged in” but it redirection is not working like define services.

So oktaAuth is able to detect a session, but you aren’t able to redirect and stay logged in? How are you doing the redirection?