Created
April 7, 2018 15:55
-
-
Save EdsonAlcala/7031d7f13a2a031ddafcddc645ed7656 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import React from 'react'; | |
| import { Button } from 'semantic-ui-react'; | |
| import { Connect, SimpleSigner } from 'uport-connect' | |
| const MNID = require('mnid'); | |
| class Login extends React.Component { | |
| loginClicked = () => { | |
| console.log("Event clicked"); | |
| const uport = new Connect('dapp-workshop', { | |
| clientId: '2onBp3mzTkqL6yYScbJdAj1BmyNXarWX5sT', | |
| network: 'rinkeby', | |
| signer: SimpleSigner('f8ee568811f011ba93b5cd7105dbdd25d9de2d34ace72ffd6c909ea79a4ff2e2') | |
| }); | |
| // Request credentials to login | |
| uport.requestCredentials({ | |
| requested: ['name', 'phone', 'country'], | |
| notifications: true // We want this if we want to recieve credentials | |
| }) | |
| .then((credentials) => { | |
| // Do something | |
| let addressPayload = MNID.decode(credentials.address); | |
| console.log(addressPayload.address); | |
| debugger; | |
| }) | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <Button onClick={this.loginClicked} positive>Login</Button> | |
| </div> | |
| ) | |
| } | |
| } | |
| export default Login; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment