Change Log

2.24.1 (2021-11-30)

Full Changelog

Fixed

2.24.0 (2021-10-12)

Full Changelog

Added

2.23.1 (2021-09-21)

Full Changelog

Changed

Fixed

2.23.0 (2021-07-20)

Full Changelog

Added

2.22.3 (2021-06-07)

Full Changelog

Changed

2.22.2 (2021-05-20)

Full Changelog

Fixed

2.22.1 (2021-04-13)

Full Changelog

Fixed

2.22.0 (2021-03-09)

[Full Changelog](https://github.com/auth0/Lock.swift/compare/2.21.0...2.22.0

Added

Changed

Fixed

2.21.0 (2020-12-04)

[Full Changelog](https://github.com/auth0/Lock.swift/compare/2.20.0...2.21.0

Added

2.20.0 (2020-10-22)

[Full Changelog](https://github.com/auth0/Lock.swift/compare/2.19.1...2.20.0

Changed

2.19.1 (2020-10-05)

[Full Changelog](https://github.com/auth0/Lock.swift/compare/2.19.0...2.19.1

Changed

2.19.0 (2020-08-25)

Full Changelog

Added

2.18.0 (2020-07-14)

Full Changelog

Changed

2.17.2 (2020-06-18)

Full Changelog

Fixed

2.17.1 (2020-05-18)

Full Changelog

Changed

2.17.0 (2020-04-22)

Full Changelog

Fixed

Security

2.16.1 (2020-03-10)

Full Changelog

Fixed

2.16.0 (2020-03-02)

Full Changelog

Changed

2.15.0 (2020-02-06)

Full Changelog

Added

Fixed

2.14.0 (2020-01-06)

Full Changelog

Added

2.13.2 (2019-11-27)

Full Changelog

Fixed

2.13.1 (2019-10-14)

Full Changelog

Fixed

2.13.0 (2019-09-30)

Full Changelog

Deprecated

Fixed

2.12.0 (2019-08-27)

Full Changelog

Added

2.11.0 (2019-07-26)

Full Changelog

Added

Changed

Fixed

2.10.1 (2019-05-07)

From this release on, the option to display social connections in small styled buttons is no longer available due to branding compliance reasons. All the social connections will now be displayed as large styled buttons.

Full Changelog

Changed

2.10.0 (2019-04-25)

Full Changelog

Added

Changed

2.9.0 (2018-12-12)

Full Changelog

Added

Changed

2.8.0 (2018-10-05)

Full Changelog

Added

2.7.0 (2018-09-18)

Full Changelog

Added

Changed

Deprecated

Fixed

2.6.0 (2018-06-12)

Full Changelog

Added

Changed

Fixed

2.5.1 (2018-01-30)

Full Changelog

Changed

2.5.0 (2018-01-10)

Full Changelog

Added

2.4.2 (2017-11-13)

Full Changelog

Fixed

2.4.1 (2017-10-19)

Full Changelog

Changed

2.4.0 (2017-09-20)

Full Changelog

Changed

Fixed

2.3.1 (2017-07-11)

Full Changelog

Added

Changed

2.3.0 (2017-06-06)

Full Changelog Closed issues

Added

2.2.0 (2017-04-25)

Full Changelog

Added

2.1.0 (2017-03-13)

Full Changelog

Added

Changed

2.0.0 (2017-02-16)

Full Changelog

Added

Changed

Fixed

2.0.0-rc.2 (2017-01-10)

Full Changelog

Added

Fixed

2.0.0-rc.1 (2016-12-16)

Full Changelog

Added

Changed

Fixed

2.0.0-beta.2 (2016-09-20)

Full Changelog

Added

2.0.0-beta.1 (2016-08-19)

Full Changelog

Lock for iOS rewritten in Swift

Usage

First to import Lock.swift

import Lock

then in your AppDelegate.swift add the following

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    return Lock.resumeAuth(url, options: options)
}

Configuration

In order to use Lock you need to provide your Auth0 Client Id and Domain, either with a Property List file

Auth0 ClientId & Domain can be found in your Auth0 Dashboard

Auth0.plist file

In your application bundle you can add a plist file named Auth0.plist with the following format

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>ClientId</key>
  <string>{YOUR_CLIENT_ID}</string>
  <key>Domain</key>
  <string>{YOUR_DOMAIN}</string>
</dict>
</plist>

Classic

Lock Classic handles authentication using Database, Social & Enterprise connections.

Currenty Lock.swift only supports Database & Social authentication and you need to tell Lock what connections it should use

To show Lock.swift, add the following snippet in any of your UIViewController

Lock
    .classic()
    .connections {
        $0.database(name: "Username-Password-Authentication", requiresUsername: true)
    }
    .options {
        $0.closable = false
    }
    .on { result in
        switch result {
        case .Success(let credentials):
            print("Obtained credentials \(credentials)")
        case .Failure(let cause):
            print("Failed with \(cause)")
        case .Cancelled:
            print("User cancelled")
        }
    }
    .present(from: self)

Specify Connections

Eventually Lock.swift will be able to load your application configuration automatically, but until then you should describe what connections it should use.

Before presenting Lock.swift you can tell it what connections it should display and use to authenticate an user. You can do that by calling the method and supply a closure that can specify the connections

.connections { connections in
    // Your connections
}

So if you need a database connection you can call

connections.database(name: "{CONNECTION_NAME}", requiresUsername: true)

Or a social connection

connections.social(name: "{CONNECTION_NAME}", style: .Facebook)

Logging

In Lock.swift options you can turn on/off logging capabilities

Lock
    .classic()
    .options {
        $0.logLevel = .All
        $0.logHttpRequest = true
    }