Skip to content

Instantly share code, notes, and snippets.

@kmikulski
Created June 7, 2018 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmikulski/a92de0d5318fd550cd3b0f5cb2d3ff8c to your computer and use it in GitHub Desktop.
Save kmikulski/a92de0d5318fd550cd3b0f5cb2d3ff8c to your computer and use it in GitHub Desktop.
the description for this gist
import React, { Component } from 'react';
class UserInfo extends Component {
constructor(props) {
super(props);
this.state = {
name: "",
email: "",
id: ""
};
this.props.keycloak.loadUserInfo().then(userInfo => {
this.setState({name: userInfo.name, email: userInfo.email, id: userInfo.sub})
});
}
render() {
return (
<div className="UserInfo">
<p>Name: {this.state.name}</p>
<p>Email: {this.state.email}</p>
<p>ID: {this.state.id}</p>
</div>
);
}
}
export default UserInfo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment