Skip to content

Add "deviceToken" parameter to authenticate() function - need it by 9/23/2019 #105

@efeluke

Description

@efeluke

In order to make "rememberDevice" work, user needs to send deviceToken in /authn API. Currently, OktaAPI.primaryAuthentication() supports "deviceToken" parameter, however, public function OktaAuthSdk.authenticate() does not. Should add it to enable the feature.

We plan to release our first version of mobile app for supporting Okta in 3 weeks, it would be great to have the fix by 9/23. Thanks.

Sample code:

class OktaAuthSdk:

public class func authenticate(with url: URL,
username: String,
password: String?,
deviceToken: String? = nil,
onStatusChange: @escaping (_ newStatus: OktaAuthStatus) -> Void,
onError: @escaping (_ error: OktaError) -> Void) {

    let unauthenticatedStatus = OktaAuthStatusUnauthenticated(oktaDomain: url)
    unauthenticatedStatus.authenticate(username: username,
                                       password: password ?? "",
                                       deviceToken: deviceToken,
                                       onStatusChange:onStatusChange,
                                       onError:onError)
}

class OktaAuthStatusUnauthenticated:

open func authenticate(username: String,
password: String,
deviceToken: String?,
onStatusChange: @escaping (_ newStatus: OktaAuthStatus) -> Void,
onError: @escaping (_ error: OktaError) -> Void) {

    restApi.primaryAuthentication(username: username,
                                  password: password,
                                  deviceToken: deviceToken,
                                  deviceFingerprint: nil)
    { result in
        self.handleServerResponse(result,
                                  onStatusChanged: onStatusChange,
                                  onError: onError)
    }
}

Metadata

Metadata

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions