Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func adminLogin(_ request: Request)throws -> ResponseRepresentable {
- guard let username = request.data[“username”]?.string,
- let password = request.data[“password”]?.string else {
- throw Abort.badRequest
- }
- let key = APIKey(id: username, secret: password)
- do {
- try request.auth.login(key, persist: true)
- } catch {
- print(“Error: “, error)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement