Skip to content

Commit 29a9916

Browse files
authored
Browser signin updates (#261)
* Support https redirect URIs in browser sign-in (#252) * Improve browser sign in error messaging * Fix import statements for other platforms (#256) * Fix problems with BrowserSignin on tvOS (#259) * Bump version numbers and include additional docs * Expose the browser providers and their factory for extension and testing > [!WARNING] > These changes require that the server resource is configured to support associated domains for this application.
1 parent bdaa32c commit 29a9916

60 files changed

Lines changed: 315 additions & 142 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OktaAuthFoundation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "OktaAuthFoundation"
33
s.module_name = "AuthFoundation"
4-
s.version = "2.1.2"
4+
s.version = "2.1.3"
55
s.summary = "Okta Authentication Foundation"
66
s.description = <<-DESC
77
Provides the foundation and common features used to authenticate users, managing the lifecycle and storage of tokens and credentials, and provide a base for other Okta SDKs to build upon.

OktaBrowserSignin.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "OktaBrowserSignin"
33
s.module_name = "BrowserSignin"
4-
s.version = "2.1.2"
4+
s.version = "2.1.3"
55
s.summary = "Okta Browser Sign In UI"
66
s.description = <<-DESC
77
Authenticate users using web-based OIDC.

OktaClient.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "OktaClient"
3-
s.version = "2.1.2"
3+
s.version = "2.1.3"
44
s.summary = "Secure client authentication, request authorization, and user management capabilities for Swift."
55
s.description = <<-DESC
66
Provides a modularized set of libraries that provide the building blocks and convenience features used to authenticate users, manage the lifecycle and storage of tokens and user credentials, and provide a base for other libraries and applications to build upon.

OktaDirectAuth.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "OktaDirectAuth"
3-
s.version = "2.1.2"
3+
s.version = "2.1.3"
44
s.summary = "Okta Direct Authentication"
55
s.description = <<-DESC
66
Enables application developers to build native sign in experiences using the Okta Direct Authentication API.

OktaIdxAuth.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'OktaIdxAuth'
3-
s.version = '2.1.2'
3+
s.version = '2.1.3'
44
s.summary = 'SDK to easily integrate the Okta Identity Engine'
55
s.description = <<-DESC
66
Integrate your native app with Okta using the Okta Identity Engine library.

OktaOAuth2.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "OktaOAuth2"
33
s.module_name = "OAuth2Auth"
4-
s.version = "2.1.2"
4+
s.version = "2.1.3"
55
s.summary = "Okta OAuth2 Authentication"
66
s.description = <<-DESC
77
Enables application developers to authenticate users utilizing a variety of OAuth2 authentication flows.

Samples/DirectAuthSignIn/UITests/Pages/SignInScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class SignInScreen: Screen {
9595
if let fieldValue = field.value as? String,
9696
!fieldValue.isEmpty
9797
{
98-
usleep(useconds_t(1000)) // Wait for the field to be selected
98+
Thread.sleep(forTimeInterval: 0.1) // Wait for the field to be selected
9999
field.tap(withNumberOfTaps: 3, numberOfTouches: 1)
100100
}
101101

Samples/Shared/Common/Testing/Screen+Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ extension WebLogin where Self: Screen {
7171
_ = app.keyboards.firstMatch.waitForExistence(timeout: .standard)
7272

7373
if !fieldValue.isEmpty {
74-
usleep(useconds_t(1000)) // Wait for the field to be selected
74+
Thread.sleep(forTimeInterval: 0.1) // Wait for the field to be selected
7575
field.tap(withNumberOfTaps: 3, numberOfTouches: 1)
7676
field.typeText("")
77-
usleep(useconds_t(500))
77+
Thread.sleep(forTimeInterval: 0.05)
7878
}
7979

8080
field.typeText(username)
@@ -143,7 +143,7 @@ extension WebLogin where Self: Screen {
143143
// Dismiss the password save reminder keyboard view in iOS 18+
144144
if app.otherElements["SFAutoFillInputView"].buttons["Not Now"].exists {
145145
app.otherElements["SFAutoFillInputView"].buttons["Not Now"].tap()
146-
usleep(useconds_t(500)) // Wait for the keyboard animation, since XCTest won't
146+
Thread.sleep(forTimeInterval: 0.1) // Wait for the keyboard animation, since XCTest won't
147147
field.tap()
148148
_ = app.keyboards.firstMatch.waitForExistence(timeout: .standard)
149149
}

Samples/WebSignIn/WebSignIn (iOS)/WebSignIn/SignInViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class SignInViewController: UIViewController {
5454
}
5555

5656
@IBAction func signIn(_ sender: Any) {
57+
signInButton.isEnabled = false
5758
let window = viewIfLoaded?.window
5859
auth?.signIn(from: window) { result in
5960
switch result {
@@ -72,6 +73,10 @@ class SignInViewController: UIViewController {
7273
case .failure(let error):
7374
self.show(error: error)
7475
}
76+
77+
Task { @MainActor in
78+
self.signInButton.isEnabled = true
79+
}
7580
}
7681
}
7782

Samples/WebSignIn/WebSignIn (macOS)/WebSignIn/SignIn/SignInView.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ struct SignInView: View {
2828
@State var signInError: (any Error)?
2929
@State var hasError: Bool = false
3030
@State var clientId: String?
31+
@State var state: SignInState = .unconfigured
32+
33+
enum SignInState: Sendable {
34+
case unconfigured
35+
case ready
36+
case signingIn
37+
case signedIn
38+
}
3139

3240
init(signedIn: Binding<Bool>) {
3341
self._signedIn = signedIn
@@ -46,6 +54,7 @@ struct SignInView: View {
4654

4755
Button("Sign In") {
4856
guard let auth = BrowserSignin.shared else { return }
57+
state = .signingIn
4958
auth.ephemeralSession = ephemeralSession
5059
Task {
5160
do {
@@ -58,7 +67,7 @@ struct SignInView: View {
5867
}
5968
}
6069
}
61-
.disabled(clientId == nil)
70+
.disabled(state != .ready)
6271
.alert(isPresented: $hasError) {
6372
Alert(
6473
title: Text("Error"),
@@ -78,8 +87,9 @@ struct SignInView: View {
7887
.padding()
7988
}
8089
.onAppear {
81-
Task {
82-
clientId = await BrowserSignin.shared?.signInFlow.client.configuration.clientId
90+
if let configuration = BrowserSignin.shared?.signInFlow.client.configuration {
91+
clientId = configuration.clientId
92+
state = .ready
8393
}
8494
}
8595
}
@@ -93,9 +103,11 @@ struct SignInView: View {
93103
let token = try await auth.signIn(from: ASPresentationAnchor())
94104
try Credential.store(token)
95105
signedIn = true
106+
state = .signedIn
96107
} catch {
97108
signInError = error
98109
signedIn = false
110+
state = .ready
99111
}
100112
}
101113
}

0 commit comments

Comments
 (0)