Releases: auth0/Lock.swift
1.27.0
2.0.0-beta.1
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 client 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
}
1.26.2
Closed Issues:
- The A0EnterpriseLoginViewController ignores the custom ClientId and Domain configuration #294
- allow lock framework to enable bitcode by default #292
- Top Level Domains on email address failing validation #248
Fixed:
- Avoid sending username if not needed #305 (hzalaz)
- Fix controllers to use the correct Lock instance #304 (hzalaz)
- Improve email validation #303 (hzalaz)
- Fixing build for macOS #293 (robbiehanson)
- build: default build enables bitcode #279 (billbonney)
1.26.1
1.26.0
Implemented enhancements:
- Not passing correct error code and domain #226
Fixed bugs:
- Force Lock's UIViewControllers in portrait mode #258
Closed issues:
- Make Error handling helper methods public #224
Merged pull requests:
- Allow to specify presentation style & iPad in landscape #270 (hzalaz)
- Make A0Token conform NSSecureCoding #267 (hzalaz)
- Allow to prefill identifier #266 (hzalaz)
- Fix issues with mfa flow #265 (hzalaz)
- Make NSErrors categories public #264 (hzalaz)
- Make sure lock works in portrait only #263 (hzalaz)
- MFA for database connections using resource owner #262 (hzalaz)
- Disable autoCorrect on credential field #260 (chirag04)
- Bugfixes & voiceover #256 (hzalaz)
1.25.0
1.24.1
1.24.0
1.23.1
1.23.0
Fixed bugs:
- Clear cookies for UIWebView and WKWebView #227
- Avoid cleaning reference to callbacks before calling them in A0WebKitViewController #222
- For TouchID use default connection name if none is specified #220
Closed issues:
- How to get the latest commits using CocoaPods? #238
- signUpWithEmail method doesn't work properly #233
- LICENSE file needs an update and readme.md needs a fix #215
- connection_scopes are ignored by A0WebViewAuthenticator #209
- Update Google Ent Auth Login screen logic #206
- Add
au
region for CDN #201 - Support customizing "user is blocked" message #195
Merged pull requests:
- Add api_type param name to fetchNewIdTokenWithIdToken and fetchNewIdTokenWithRefreshToken #239 (rweindl)
- If auth parameters are nil, use defaults #237 (hzalaz)
- Avoid cleaning callbacks before vc is dismissed #236 (hzalaz)
- Update TouchID authentication #235 (hzalaz)
- Use new change password flow #232 (hzalaz)
- Clear session of UIWebView & WKWebView #231 (hzalaz)
- Fixed property inheritance warning #230 (ppaulojr)
- Remove apple versioning from bundles #229 (hzalaz)
- Update license and readme #216 (aguerere)
- Update to AFNetworking 3 #213 (hzalaz)
- Fix missing device when scope has offline_access #211 (hzalaz)
- connection_scopes are ignored by A0WebViewAuthenticator #210 (keeth)