A Swift & iOS framework to authenticate using Auth0 and with a Native Look & Feel
MIT License
Bot releases are visible (Hide)
Published by hzalaz over 7 years ago
Fixed
Published by hzalaz over 7 years ago
Added
Changed
Fixed
Published by hzalaz over 7 years ago
Fixed
Published by hzalaz almost 8 years ago
Published by hzalaz almost 8 years ago
Added
Changed
Fixed
Published by hzalaz about 8 years ago
Published by hzalaz about 8 years ago
Closed Issues:
Fixed:
Published by hzalaz about 8 years ago
Merged pull requests:
Published by hzalaz about 8 years ago
Lock for iOS rewritten in Swift
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)
}
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
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>
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)
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)
In Lock.swift options you can turn on/off logging capabilities
Lock
.classic()
.options {
$0.logLevel = .All
$0.logHttpRequest = true
}
Published by hzalaz over 8 years ago
Implemented enhancements:
Fixed bugs:
Closed issues:
Merged pull requests:
Published by hzalaz over 8 years ago
Published by hzalaz over 8 years ago
Merged pull requests:
Published by hzalaz over 8 years ago
Fixed bugs:
Closed issues:
au
region for CDN #201
Merged pull requests: