Created
April 21, 2017 22:04
-
-
Save brad82/e84f26a157c949df62f38186bf960215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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