File: auth.coffee
Defined in: | lib/resin/auth |
Method Summary
-
~
(void)
authenticate(credentials, callback)
Private
Authenticate with the server
resin.auth.authenticate credentials, (error, token) -> throw error if error? console.log(token)
-
~
(void)
login(credentials, callback)
Login to Resin.io
Is the login is successful, the token is persisted between sessions.
-
~
(void)
isLoggedIn(callback)
Check if you're logged in
resin.auth.isLoggedIn (isLoggedIn) -> if isLoggedIn console.log('I\'m in!') else console.log('Too bad!')
-
~
(void)
getToken(callback)
Get current logged in user's token
resin.auth.getToken (error, token) -> throw error if error? console.log(token)
-
~
(void)
logout(callback)
Logout from Resin.io
resin.auth.logout (error) -> throw error if error? console.log('I\'m out!')
-
~
(void)
parseCredentials(credentials, callback)
Private
Parse colon separated credentials
resin.auth.parseCredentials 'johndoe:secret', (error, credentials) -> throw error if error? console.log(credentials.username) console.log(credentials.password)
Method Details
~
(void)
authenticate(credentials, callback)
Private
Authenticate with the server
resin.auth.authenticate credentials, (error, token) -> throw error if error? console.log(token)
~
(void)
login(credentials, callback)
Login to Resin.io
Is the login is successful, the token is persisted between sessions.
resin.auth.login credentials, (error) -> throw error if error? console.log('I\'m logged in!')
~
(void)
isLoggedIn(callback)
Check if you're logged in
resin.auth.isLoggedIn (isLoggedIn) -> if isLoggedIn
console.log('I\'m in!') else
console.log('Too bad!')
~
(void)
getToken(callback)
Get current logged in user's token
resin.auth.getToken (error, token) -> throw error if error? console.log(token)
~
(void)
logout(callback)
Logout from Resin.io
resin.auth.logout (error) -> throw error if error? console.log('I\'m out!')
~
(void)
parseCredentials(credentials, callback)
Private
Parse colon separated credentials
resin.auth.parseCredentials 'johndoe:secret', (error, credentials) -> throw error if error? console.log(credentials.username) console.log(credentials.password)