Skip to content

Commit 1d71bac

Browse files
OKTA-976972 - Mobile iOS redirect guide updates (#5576)
* Add change to BrowserSignin from WebAuthenticationUI * Updates to mobile redirect guide as per Akanksha Bhasin * Updates from previous PR edit
1 parent 31bd297 commit 1d71bac

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

packages/@okta/vuepress-site/docs/guides/sign-into-mobile-app-redirect/main/index.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Add authentication to your mobile app using the Okta [redirect model](https://de
1313
* Create an integration that represents your app in your Okta org.
1414
* Add dependencies and configure your mobile app to use Okta.
1515
* Add a browser-based sign-in flow that Okta controls (redirect authentication).
16-
* Load the details of the signed in user and check for an existing authenticated session at app startup.
16+
* Load the details of the signed-in user and check for an existing authenticated session at app startup.
1717
* Refresh tokens to keep the user signed in.
1818
* Make server calls using an access token for the session.
1919
* Test your integration by signing in as a user.
@@ -33,25 +33,26 @@ Make a note of your Okta domain. Use it wherever `${yourOktaDomain}` appears in
3333
> **Note**: If you're using an existing org, verify that API Access Management is enabled: Open your Admin Console, go to **Security** > **API**, and verify that an **Authorization Servers** tab is present. If not, choose one of the following:
3434
>
3535
> * Contact your support team to enable the feature in your org.
36-
> * Use the Admin Console to create your app integrations instead of the CLI.
36+
> * Use the Admin Console to create your app integrations.
3737
>
3838
3939
## Create an Okta integration for your app
4040

4141
An app integration represents your app in your Okta org. The integration configures how your app integrates with the Okta services. This includes which users and groups have access, authentication policies, token refresh requirements, redirect URLs, and more. The integration includes configuration information required by the app to access Okta.
4242

43-
To create your app integration in Okta using the Admin Console:
43+
To create your app integration in the Okta Admin Console:
4444

45-
1. [Sign in to your Okta organization](https://developer.okta.com/login) with your administrator account. Click **Admin** on the top right of the page.
46-
1. Open the apps configuration pane by selecting **Applications** > **Applications**. Click **Create App Integration**.
45+
1. [Sign in to your Okta org](https://developer.okta.com/login) with your admin account. Click **Admin** on the top right of the page.
46+
1. Go to **Applications** > **Applications**. Click **Create App Integration**.
4747
1. Select a **Sign-in method** of **OIDC - OpenID Connect**.
48-
1. Select an **Application type** of **Native Application**, then click **Next**.
48+
1. Select an **Application type** of **Native Application**, and then click **Next**.
4949
> **Note:** If you choose the wrong app type, it can break the sign-in or sign-out flows. Integrations require the verification of a client secret, which public clients don't have.
5050
1. Enter an **App integration name**.
5151
1. Enter the callback routes.
5252

5353
<StackSnippet snippet="redirectvalues" />
5454

55+
1. Select the type of **Controlled access** for your app in the **Assignments** section. You can allow all users to have access or limit access to individuals and groups. See [Assign app integrations](https://help.okta.com/okta_help.htm?type=oie&id=ext-lcm-user-app-assign).
5556
1. Click **Save** to update the Okta app settings.
5657

5758
## Create an app
@@ -139,7 +140,7 @@ Enable a refresh token in your app integration by following these steps:
139140
1. Choose **Applications > Applications** to show the app integrations.
140141
1. Click the name of your integration to open the configuration manager.
141142
1. Click **Edit** in the **General Settings** section.
142-
1. Select **Refresh Token** in the **Application** section.
143+
1. Select **Refresh Token** as the grant type.
143144
1. Click **Save** at the bottom of the **General Settings** section.
144145

145146
<StackSnippet snippet="refresh" />
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
Add the latest Okta OIDC package to your project:
22

3-
1. Choose **File** > **Add Packages**. The Swift Package Manager opens.
3+
1. Choose **File** > **Add Package Dependencies**. The Swift Package Manager opens.
44
1. Enter the URL for the package in the search field:
55
`https://github.com/okta/okta-mobile-swift.git`
6-
1. Confirm that the `okta-mobile-swift` package is selected, that the **Dependency Rule** is set to the main branch, and that your project is selected.
6+
1. Confirm that the `okta-mobile-swift` package is selected, that the **Dependency Rule** is set to the master branch, and that your project is selected.
7+
1. Click **Add Package**.
8+
1. Select the package products that appear in the dialog: **AuthFoundation**, **OktaOAuth2**, and **BrowserSignin**, click **Add to target**, and select your project.
79
1. Click **Add Package**.
8-
1. Select the package products that appear in the dialog: **AuthFoundation**, **OktaOAuth2**, and **WebAuthenticationUI**, and then click **Add Package**.
910

1011
Open `ContentView.swift` and update the `import` statements to use the authorization foundation and WebAuthn UI libraries:
1112

1213
```swift
1314
import SwiftUI
1415
import AuthFoundation
15-
import WebAuthenticationUI
16+
import BrowserSignin
1617
```

packages/@okta/vuepress-site/docs/guides/sign-into-mobile-app-redirect/main/ios/checkfortoken.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ When you check for an existing session, it may take two steps:
55

66
The `Credential` class manages the tokens for a user. The `signIn()` function that you wrote in [Open the sign-in page](#open-the-sign-in-page) calls `store(_:)` to save the user's credentials. A session exists if there's a default credential. Although there are calls to check if a credential is expired and to request a refresh, this code uses `refreshIfNeeded()` that only tries to refresh the token if it's expired.
77

8-
Check for an existing session by adding an `.onAppear` modifier above the `.alert` modifier of the main content view:
8+
Check for an existing session by adding an `.onAppear` modifier above the `.alert(isPresented:){}` modifier of the main content view:
99

1010
```swift
1111
var body: some View {
@@ -38,6 +38,6 @@ var body: some View {
3838
busy = false
3939
}
4040
}
41-
.alert {
41+
.alert(isPresented:) {
4242
...
4343
```

packages/@okta/vuepress-site/docs/guides/sign-into-mobile-app-redirect/main/ios/configmid.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The SDK loads the configuration values from a configuration file (`Okta.plist`) if it exists in your main bundle. You can also specify the values in the code using `WebAuthentication(issuer:clientId:scopes:redirectUri:logoutRedirectUri:additionalParameters:)`.
1+
The SDK loads the configuration values from a configuration file (`Okta.plist`) if it exists in your main bundle. You can also specify the values in the code using `BrowserSignin(issuer:clientId:scopes:redirectUri:logoutRedirectUri:additionalParameters:)`.
22

33
Create the Okta configuration file and add the keys and values for your app integration:
44

packages/@okta/vuepress-site/docs/guides/sign-into-mobile-app-redirect/main/ios/opensignin.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Update the `signIn()` function of `ContentView.swift` with the code to sign in t
44
func signIn() {
55
Task {
66
do {
7-
if let token = try await WebAuthentication.shared?.signIn(from: nil)
7+
if let token = try await BrowserSignin.shared?.signIn(from: nil)
88
{
99
try Credential.store(token)
1010
updateStatus("Signed in", infoText: "", signedInStatus: true)
@@ -32,7 +32,7 @@ func signOut() {
3232
do {
3333
// Show the activity indicator and block UI input.
3434
busy = true
35-
try await WebAuthentication.shared?.signOut(from: nil)
35+
try await BrowserSignin.shared?.signOut(from: nil)
3636
// Remove the stored credential.
3737
try Credential.default?.remove()
3838
updateStatus("Signed out", infoText: "", signedInStatus: false)

packages/@okta/vuepress-site/docs/guides/sign-into-mobile-app-redirect/main/ios/refresh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
You refreshed a token when checking for an existing session in [Check for a session at startup](#check-for-a-session-at-startup). In this case you may want to catch any errors that occur.
22

3-
Update `refreshToken` in `ContentView.swift` with the following code:
3+
Update the `refreshToken` function in `ContentView.swift` with the following code:
44

55
```swift
66
func refreshToken() {
@@ -29,7 +29,7 @@ Tokens are refreshed regularly. Each refresh requires network activity, which is
2929
* Check if the device is using cellular data rather than Wi-Fi.
3030
* Handle failed refresh attempts, especially when the server can't be reached.
3131

32-
The `Token` class contains information such as expiry date. The following function displays the access token, its issue and expiry dates, and any associated refresh token in the info area:
32+
Update the `showTokenInfo` function in `ContentView.swift` with the following code:
3333

3434
```swift
3535
func showTokenInfo() {

0 commit comments

Comments
 (0)