Skip to content

Instantly share code, notes, and snippets.

@rjayako
Created October 27, 2015 12:23
Show Gist options
  • Save rjayako/c094c72ca6c2afb0d95a to your computer and use it in GitHub Desktop.
Save rjayako/c094c72ca6c2afb0d95a to your computer and use it in GitHub Desktop.
onLoginPressed(){
this.setState({showProgress:true});
var b = new buffer.Buffer(this.state.username +':'+ this.state.password);
var encodedAuth = b.toString('base64');
fetch('https://api.github.com/user',{
headers:{
'Authorization' : 'Basic' + encodedAuth
}
})
.then((response)=>{
return response.json();
})
.then((results)=>{
console.log(results);
this.setState({showProgress:false});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment