Last active
July 17, 2018 09:12
-
-
Save hwjeremy/e07b9e46863bc3417ad958660197f568 to your computer and use it in GitHub Desktop.
Create a Session in Amatino Swift. This is analogous to "logging in" to the Amatino API
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
// Amatino Swift: https://github.com/amatino-code/amatino-swift | |
// Double entry accounting API | |
try Session.create( | |
email: "clever@cookie.com", | |
secret: "high entropy passphrase", | |
callback: { (error, session) in | |
guard error == nil else { | |
// Handle errors. In particular, look out for 401, which | |
// would indicate invalid credentials such as a mistyped | |
// passphrase. | |
} | |
// Store the session somewhere for use with later requests. | |
print("Created new Session with ID: \(session.id)") | |
return | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment