OKTA SSO login through Angular SPA application

Hi, I have requirement to access a website both directly and through SSO. Built it on Angular SPA and have okta sign in widget in it. direct login works just fine. But SSO does not. I am fairly new to OKTA integration and Angular. Can you please help guide me toward any article or suggestions on how to achieve this? Client and we have OKTA IDP set up and I was told setup is fine (I don’t have access to it)

Here are a couple of guides that you might find helpful:

  • Add user authentication to your Angular app: This is a collection of resources that help you integrate with Okta using the Okta-hosted Sign-In Widget using OpenID Connect (OIDC) client libraries. It includes a quickstart, a sample app, and SDK documentation.
  • Sign users in to your SPA using the redirect model: This is another guide that shows how to use OIDC to sign users in to your SPA using the redirect model. It also explains how to handle tokens, secure routes, sign users out, and revoke tokens.

Thank you for replying Adam. I checked both of them when developing. when I click on website widget from okta app, it is taking to the website but its asking for username and password again instead of doing SSO and login directly. and I see this.isAuthenticated = false in login page. I use below code to get authentication status. Do I need to use anything else for SSO to work?

(isAuthenticated: boolean) => this.isAuthenticated = isAuthenticated

1 Like

Hi @pmoda, SSO requires shared session cookies within websites. You can check for an Okta session and redirect the user to a specific page - GitHub - okta/okta-auth-js: The official js wrapper around Okta's auth API if an active session exists.


Thanks sigama. I am seeing following error when trying to check for okta session . From https://xxxxxxx.okta.com/api/v1/sessions/me I am seeing this error (when putting it in browser) {“errorCode”:“E0000007”,“errorSummary”:“Not found: Resource not found: me (Session)”,“errorLink”:“E0000007”,“errorId”:“oaeG59SHnJyTLC6PJpFkJ8ZSw”,“errorCauses”:} and in F12, I am seeing 404 error.

FYI: I don’t have access to admin for our org okta so I need to request something from that team, please let me know.