Skip to content

SessionTokenFlow 'start' function error #135

@ntorrescodigodelsur

Description

@ntorrescodigodelsur

Describe the bug?

We are using the SessionTokenFlow to sign-in users into our app, which includes an SMS verification feature. When invoking the start function of the SessionTokenFlow, we encounter an "Invalid key data" error, even if we force a call to Credential.default?.remove() beforehand. This issue is peculiar because it is not specific to any user; rather, it is related to certain devices. We observe that signing in works on some devices but not on others. The only solution we have discovered so far is to uninstall the app and reinstall it.

The sessionToken parameter that we are using is the one that we receive in the OktaAuthStatusSuccess object and it’s correctly formed.

func authenticate(sessionToken: String, completion: @escaping (Error?) -> Void) {
        
        guard let oktaFileURL = oktaPlistName else {return}
        
        let flow: SessionTokenFlow
        do {
            flow = try SessionTokenFlow(plist: oktaFileURL)
        } catch {
            print("Error creating SessionTokenFlow")
            return
        }
        
        flow.start(with: sessionToken, context: nil) { [weak self] result in
            switch result {
            case .success(let token):
                …
            case .failure(let error):
		// HERE WE ARE RECEIVING “Invalid key data.” error
                self?.handleError(error: error, completion: completion)
                return
            }
        }
    }

What is expected to happen?

start function return success with a valid Okta Token

What is the actual behavior?

start function is returning "Invalid key data"

Reproduction Steps?

Install the app and try to sign-in

Additional Information?

No response

SDK Version(s)

1.3.0

Build Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions