Skip to content

Commit 9bc29dd

Browse files
Merge pull request #5418 from okta/tbs-okta-922083-sign-in-spa-embedded-widget
Update sign in to SPA embedded SIW guide
2 parents 8fbe8a0 + c4b4831 commit 9bc29dd

File tree

8 files changed

+118
-39
lines changed

8 files changed

+118
-39
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Before you integrate Okta authentication in your app, register the app in your Okta org. This provides you with the OpenID Connect (OIDC) client ID for authentication requests from your app. Register your app by creating an app integration through the [Okta CLI](https://cli.okta.com/), the [Okta Apps API](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/), or through the [Admin Console](/docs/concepts/okta-organizations/#admin-console) using the following steps.
2+
3+
1. In the Admin Console, go to **Applications** > **Applications**.
4+
1. Click **Create App Integration**.
5+
1. Select **OIDC - OpenID Connect** as the **Sign-in method**.
6+
1. Select **Single-Page Application** for the **Application Type**, and then click **Next**.
7+
1. On the **New Single-Page App Integration** page, enter the following information:
8+
9+
* Enter an app name.
10+
* Select the **Refresh Token** checkbox.
11+
* Select **Advanced** in the **Grant type** section, and then select the **Interaction Code** checkbox.
12+
13+
<VerifyICGrantType />
14+
15+
* Set **Sign-in redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:4200/login/callback` if you're using the sample app.
16+
* Set **Sign-out redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:4200` if you're using the sample app.
17+
18+
1. In the **Assignments** section, select **Allow everyone in your organization to access**, and then click **Save**.
19+
1. In the **General Settings** section on the **General** tab, click **Edit**.
20+
1. Under **EMAIL VERIFICATION EXPERIENCE** set the **Callback URI** to a URI that’s appropriate for your app. For example, `http://localhost:4200/login/callback` if you're using the sample app.
21+
1. Click **Save**.
22+
23+
1. Select the **Sign On** tab and scroll to the **User authentication** section. New apps are automatically assigned the shared default [authentication policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-about-asop). This policy has a catch-all rule that allows a user access to the app using either one or two factors, depending on your org setup.
24+
1. For this use case, you want to use only the password factor. Click **Edit** and select the **Password only** [preset policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-preset-auth-policies) to assign it to your app.
25+
1. Click **Save**.
26+
27+
> **Note:** Remember to [update the password authenticator policy rule](/docs/guides/oie-embedded-common-org-setup/nodejs/main/#update-the-password-authenticator-to-password-only) to not require any additional verification.
28+
29+
1. Verify that the custom authorization server uses the **Interaction Code** grant type.
30+
* Go to **Security** > **API** > **Authorization Servers**.
31+
* Select the **default** server.
32+
* Edit the **Default Policy Rule**.
33+
* Click **Advanced** in the **IF Grant type is** section and ensure that the **Interaction Code** checkbox is selected.
34+
35+
<VerifyICGrantType />
36+
37+
1. On the **Security** > **API** > **Trusted Origins** page, ensure that there’s an entry for your sign-in redirect URI. See [Enable CORS](/docs/guides/enable-cors/).

packages/@okta/vuepress-site/docs/guides/sign-in-to-spa-embedded-widget/main/angular/load-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To add or customize application styles, you need to update the `angular.json` co
1919
Run the following command. This replaces all existing styles, so you need to add any existing style files to this command.
2020

2121
```shell
22-
ng config projects.okta-signin-test.architect.build.options.styles '["src/styles.css", "./node_modules/@okta/okta-signin-widget/dist/css/okta-sign-in.min.css"]'
22+
ng config projects.okta-signin-test.architect.build.options.styles '["src/styles.css", "./node_modules/@okta/okta-signin-widget/css/okta-sign-in.min.css"]'
2323
```
2424

2525
#### Angular.json

packages/@okta/vuepress-site/docs/guides/sign-in-to-spa-embedded-widget/main/index.md

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,7 @@ title: Sign in to your SPA with the embedded Okta Sign-In Widget
1414

1515
## Create an Okta app integration
1616

17-
Before you integrate Okta authentication to your app, register your app in your Okta org. This provides you with the OpenID Connect client ID for authentication requests from your app. Register your app by creating an Okta app integration through the [Okta CLI](https://cli.okta.com/), the [Okta Apps API](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/), or through the [Admin Console](/docs/concepts/okta-organizations/#admin-console) with the following steps.
18-
19-
1. In the Admin Console, go to **Applications** > **Applications**.
20-
1. Click **Create App Integration**.
21-
1. Select **OIDC - OpenID Connect** as the **Sign-in method**.
22-
1. Select **Single-Page Application** for the **Application Type**, and then click **Next**.
23-
1. On the **New Single-Page App Integration** page:
24-
25-
* Enter an application name.
26-
* Select the **Refresh Token** checkbox.
27-
* Select **Advanced** in the **Grant type** section, and then select the **Interaction Code** checkbox.
28-
29-
<VerifyICGrantType />
30-
31-
* Set **Sign-in redirect URIs** to a URI that is appropriate for your app. For example, `http://localhost:8080/login/callback` if you're using the sample app.
32-
* Set **Sign-out redirect URIs** to a URI that is appropriate for your app. For example, `http://localhost:8080` if you're using the sample app.
33-
34-
1. In the **Assignments** section, select **Allow everyone in your organization to access**, and click **Save**.
35-
1. In the **General Settings** section on the **General** tab, click **Edit**.
36-
1. Under **EMAIL VERIFICATION EXPERIENCE** set **Callback URI** to a URI that is appropriate for your app. For example, `http://localhost:8080/login/callback` if you're using the sample app.
37-
1. Click **Save**.
38-
39-
1. Select the **Sign On** tab and scroll down to the **User authentication** section. New apps are automatically assigned the shared default [authentication policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-about-asop). This policy has a catch-all rule that allows a user access to the app using either one or two factors, depending on your org setup.
40-
1. For this use case, we want to use only the password factor. Click **Edit** and select the **Password only** [preset policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-preset-auth-policies) to assign it to your app.
41-
1. Click **Save**.
42-
43-
> **Note:** Be sure to also [update the password authenticator policy rule](/docs/guides/oie-embedded-common-org-setup/nodejs/main/#update-the-password-authenticator-to-password-only) to not require any additional verification.
44-
45-
1. In the **Security** > **API** > **Authorization Servers** section, verify that the custom authorization server uses the Interaction Code grant type by selecting the **default** server, clicking **Access Policies**, and then editing the **Default Policy Rule**. Click **Advanced** in the **IF Grant type is** section to ensure that the **Interaction Code** checkbox is selected.
46-
47-
<VerifyICGrantType />
48-
49-
1. In the **Security** > **API** > **Trusted Origins** page, ensure that there is an entry for your sign-in redirect URI. See [Enable CORS](/docs/guides/enable-cors/).
17+
<StackSnippet snippet="create-app-integration" />
5018

5119
### Okta org app integration configuration settings
5220

packages/@okta/vuepress-site/docs/guides/sign-in-to-spa-embedded-widget/main/react/basic-sign-in.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,15 @@ Rename the `src/index.js` file to `src/index.jsx` and edit the file to call the
193193

194194
```jsx
195195
import React from 'react';
196-
import ReactDOM from 'react-dom';
196+
import { createRoot } from 'react-dom/client';
197197
import { BrowserRouter as Router } from 'react-router-dom';
198198
import App from './App';
199199

200-
ReactDOM.render(
200+
const root = createRoot(document.getElementById("root"))
201+
root.render(
201202
<Router>
202203
<App />
203204
</Router>,
204-
document.getElementById('root'),
205205
);
206206
```
207207

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Before you integrate Okta authentication to your app, register your app in your Okta org. This provides you with the OpenID Connect client ID for authentication requests from your app. Register your app by creating an Okta app integration through the [Okta CLI](https://cli.okta.com/), the [Okta Apps API](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/), or through the [Admin Console](/docs/concepts/okta-organizations/#admin-console) with the following steps.
2+
3+
1. In the Admin Console, go to **Applications** > **Applications**.
4+
1. Click **Create App Integration**.
5+
1. Select **OIDC - OpenID Connect** as the **Sign-in method**.
6+
1. Select **Single-Page Application** for the **Application Type**, and then click **Next**.
7+
1. On the **New Single-Page App Integration** page, enter the following information:
8+
9+
* Enter an app name.
10+
* Select the **Refresh Token** checkbox.
11+
* Select **Advanced** in the **Grant type** section, and then select the **Interaction Code** checkbox.
12+
13+
<VerifyICGrantType />
14+
15+
* Set **Sign-in redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:3000/login/callback` if you're using the sample app.
16+
* Set **Sign-out redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:3000` if you're using the sample app.
17+
18+
1. In the **Assignments** section, select **Allow everyone in your organization to access**, and then click **Save**.
19+
1. In the **General Settings** section on the **General** tab, click **Edit**.
20+
1. Under **EMAIL VERIFICATION EXPERIENCE**, set the **Callback URI** to a URI that’s appropriate for your app. For example, `http://localhost:3000/login/callback` if you're using the sample app.
21+
1. Click **Save**.
22+
23+
1. Select the **Sign On** tab and scroll to the **User authentication** section. New apps are automatically assigned the shared default [authentication policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-about-asop). This policy has a catch-all rule that allows a user access to the app using either one or two factors, depending on your org setup.
24+
1. For this use case, you want to use only the password factor. Click **Edit** and select the **Password only** [preset policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-preset-auth-policies) to assign it to your app.
25+
1. Click **Save**.
26+
27+
> **Note:** Remember to [update the password authenticator policy rule](/docs/guides/oie-embedded-common-org-setup/nodejs/main/#update-the-password-authenticator-to-password-only) to not require any additional verification.
28+
29+
1. Verify that the custom authorization server uses the **Interaction Code** grant type.
30+
* Go to **Security** > **API** > **Authorization Servers**.
31+
* Select the **default** server.
32+
* Edit the **Default Policy Rule**.
33+
* Click **Advanced** in the **IF Grant type is** section and ensure that the **Interaction Code** checkbox is selected.
34+
35+
<VerifyICGrantType />
36+
37+
1. In the **Security** > **API** > **Trusted Origins** page, ensure that there’s an entry for your sign-in redirect URI. See [Enable CORS](/docs/guides/enable-cors/).

packages/@okta/vuepress-site/docs/guides/sign-in-to-spa-embedded-widget/main/react/load-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To render the Sign-In Widget in React, you must create a wrapper that allows you
3939
```js
4040
import React, { useEffect, useRef } from 'react';
4141
import OktaSignIn from '@okta/okta-signin-widget';
42-
import '@okta/okta-signin-widget/dist/css/okta-sign-in.min.css';
42+
import '@okta/okta-signin-widget/css/okta-sign-in.min.css';
4343
import config from './config';
4444

4545
const OktaSignInWidget = ({ onSuccess, onError }) => {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Before you integrate Okta authentication to your app, register your app in your Okta org. This provides you with the OpenID Connect client ID for authentication requests from your app. Register your app by creating an Okta app integration through the [Okta CLI](https://cli.okta.com/), the [Okta Apps API](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/), or through the [Admin Console](/docs/concepts/okta-organizations/#admin-console) with the following steps.
2+
3+
1. In the Admin Console, go to **Applications** > **Applications**.
4+
1. Click **Create App Integration**.
5+
1. Select **OIDC - OpenID Connect** as the **Sign-in method**.
6+
1. Select **Single-Page Application** for the **Application Type**, and then click **Next**.
7+
1. On the **New Single-Page App Integration** page, enter the following information:
8+
9+
* Enter an app name.
10+
* Select the **Refresh Token** checkbox.
11+
* Select **Advanced** in the **Grant type** section, and then select the **Interaction Code** checkbox.
12+
13+
<VerifyICGrantType />
14+
15+
* Set **Sign-in redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:8080/login/callback` if you're using the sample app.
16+
* Set **Sign-out redirect URIs** to a URI that’s appropriate for your app. For example, `http://localhost:8080` if you're using the sample app.
17+
18+
1. In the **Assignments** section, select **Allow everyone in your organization to access**, and then click **Save**.
19+
1. In the **General Settings** section on the **General** tab, click **Edit**.
20+
1. Under **EMAIL VERIFICATION EXPERIENCE** set the **Callback URI** to a URI that’s appropriate for your app. For example, `http://localhost:8080/login/callback` if you're using the sample app.
21+
1. Click **Save**.
22+
23+
1. Select the **Sign On** tab and scroll down to the **User authentication** section. New apps are automatically assigned the shared default [authentication policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-about-asop). This policy has a catch-all rule that allows a user access to the app using either one or two factors, depending on your org setup.
24+
1. For this use case, you want to use only the password factor. Click **Edit** and select the **Password only** [preset policy](https://help.okta.com/okta_help.htm?type=oie&id=ext-preset-auth-policies) to assign it to your app.
25+
1. Click **Save**.
26+
27+
> **Note:** Remember to [update the password authenticator policy rule](/docs/guides/oie-embedded-common-org-setup/nodejs/main/#update-the-password-authenticator-to-password-only) to not require any additional verification.
28+
29+
1. Verify that the custom authorization server uses the **Interaction Code** grant type.
30+
* Go to **Security** > **API** > **Authorization Servers**.
31+
* Select the **default** server.
32+
* Edit the **Default Policy Rule**.
33+
* Click **Advanced** in the **IF Grant type is** section and ensure that the **Interaction Code** checkbox is selected.
34+
35+
<VerifyICGrantType />
36+
37+
1. In the **Security** > **API** > **Trusted Origins** page, ensure that there’s an entry for your sign-in redirect URI. See [Enable CORS](/docs/guides/enable-cors/).

packages/@okta/vuepress-site/docs/guides/sign-in-to-spa-embedded-widget/main/vue/load-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ To render the Sign-In Widget in Vue.js, you must create a wrapper that allows yo
6868

6969
<script>
7070
import OktaSignIn from '@okta/okta-signin-widget'
71-
import '@okta/okta-signin-widget/dist/css/okta-sign-in.min.css'
71+
import '@okta/okta-signin-widget/css/okta-sign-in.min.css'
7272
7373
import sampleConfig from '../config'
7474

0 commit comments

Comments
 (0)