Created
October 10, 2018 21:18
-
-
Save joshcanhelp/74770b69ad678b25c2426c126eb31895 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
function login (email, password, callback) { | |
console.log(email); | |
var request = require("request"); | |
request.post( | |
"[APP_ENDPOINT_HERE]", | |
{ | |
form: { | |
username:email, | |
password:password, | |
access_token:"[ACCESS_TOKEN_HERE]" | |
}, | |
}, function(error, response, body){ | |
console.log(email); | |
console.log(password); | |
if ( error ) { | |
return callback(error); | |
} | |
var info = JSON.parse(body); | |
if (info.error) { | |
console.log(info); | |
callback(); | |
} else { | |
var profile = { | |
user_id: info.data.ID, | |
username: info.data.user_login, | |
email_verified: true, | |
email: info.data.user_email, | |
name: info.data.display_name | |
}; | |
callback(null, profile); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment