Skip to content

Instantly share code, notes, and snippets.

@joshcanhelp
Created October 10, 2018 21:18
Show Gist options
  • Save joshcanhelp/74770b69ad678b25c2426c126eb31895 to your computer and use it in GitHub Desktop.
Save joshcanhelp/74770b69ad678b25c2426c126eb31895 to your computer and use it in GitHub Desktop.
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