Skip to content

Instantly share code, notes, and snippets.

@brad82
Created April 21, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brad82/e84f26a157c949df62f38186bf960215 to your computer and use it in GitHub Desktop.
Save brad82/e84f26a157c949df62f38186bf960215 to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// Firstrate Football
//
// Created by Brad Morris on 21/04/2017.
// Copyright © 2017 Brad Morris. All rights reserved.
//
import UIKit
import Alamofire
class ViewController: UIViewController {
@IBOutlet weak var email: UITextField!
@IBOutlet weak var password: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func loginButtonWasPressed(_ sender: Any) {
self.attemptLogin(email: self.email.text!, password: self.password.text!)
}
func attemptLogin(email: String, password: String) {
Alamofire.request("http://api.firstratefootball.com/v1/oauth/token", method: .post, parameters: [
"grant_type": "password",
"client_id": "1",
"client_secret": "CFsncEJrRsawp1wEaMlaQxyLuNOg3UBWp8urmrZF",
"username": email,
"password": password
]).responseJSON { response in
print(response.result.value)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment