This section describes how to use the Accounts and Template apps, demonstrating how to use GitHub as an identity provider to create your own blockchain-based account, and how to authorize access from another app.
|
Note
|
The following procedure assumes that you have performed the steps described in the Configure the Example and Run the Example Locally sections. |
-
Open the browser tab displaying the Accounts app.
The URL for the Accounts app is
http://localhost:3025. -
Open the browser’s developer tools and select the console tab.
Verify that you see the
interbit-middleware/CHAIN_BLOCKINGstatus logged to the console for theaccountsPrivatechain.NoteIf you do not see interbit-middleware/CHAIN_BLOCKING, but you do seeinterbit-middleware: reducer() Object, reload the page.The Interbit middleware prints a number of messages to the console so that you can see, for instance, when chains have loaded and actions have been dispatched. The Accounts app is fully up and running when you see the above message. At this point, you can dispatch actions to your
accountsPrivatechain. -
Navigate to the
create-accountpage by clicking on the Create Account / Sign in link in the page header. The Create account screen is displayed: -
Click the Create Account button. A dialog appears with a
disclaimer, asking you to confirm that you’re aware that the Interbit
platform is experimental: -
Check the I acknowledge that I have read and understood this
disclaimer checkbox, then click the Continue button. The
GitHub authorization screen is displayed:NoteIf you are not already signed in to your GitHub account, you would see a GitHub login screen first. -
Review the request for access, then click the Authorize username
button. Once the authorization is complete, the My Account screen
is displayed:When you see Signed-in at the right of the page header, you know that authentication is successful.
Congratulations! You have created an Interbit account. You can make
changes to your personal account information and see how the new blocks
are added to your accountsPrivate chain with each change.
-
Verify that your user account information is on the private chain. Navigate to the Block Explorer page and expand the
profileobject property in theaccountsPrivatechain.If you have not made any changes to your user profile information, you should see the that the
nameandgitHub-identityproperties have values and that your GitHub profile information is stored ingitHub-identity. -
Verify that your user account information is not yet shared with any other apps by checking that the
sharedproperty in theaccountsPrivatechain state is empty.
Now that we have created a user account on the Accounts app, we can
authorize the interbit-template app to read your name and email from
your private accounts chain.
-
Open the browser tab displaying the Template app.
The URL for the Template app is
http://localhost:3000. -
Open the browser’s developer tools and select the console tab.
Verify that you see the
interbit-middleware/CHAIN_BLOCKINGstatus logged to the console for thetemplatePrivatechain.NoteIf you do not see interbit-middleware/CHAIN_BLOCKING, but you do seeinterbit-middleware: reducer() Object, reload the page. -
Verify that no data is shared on the
templatePrivatechain.Navigate to the Block Explorer page and check that the
sharedProfileproperty in thetemplatePrivatechain state is empty. -
Click the Connect to Profile link in the header to navigate to the
/cauth/requestpage. -
Click the Request cAuth button on the /cauth/requestpage.At this point, you are redirected to the Accounts app.
The Accounts app’s authorization screen is displayed:
The
templatePrivatechain is requesting a read join with theaccountsPrivatechain for thenameandemailprofile fields. Joins can be configured so that only specific fields are shared. Since theemailfield does not yet exist, you are given the opportunity to create and populate the field. -
Click the Add email link, enter an email address, then click the Save button.
The authorization screen updates, and the Accept button becomes active:
Using the browser’s developer console, you can verify that the
accountsPrivatechain has a new block, and that the email address has been added to the profile. -
Authorize the request for information by clicking the Accept
button.At this point, you are redirected to the Template app.
In the Template app and should see a message stating
Complete the cAuth loopwith a profile identifier of the formPROFILE-**. -
Complete the chain authorization flow by clicking the Complete
cAuth button.The button click dispatches an action to the
templatePrivatechain and updates the state with the shared profile information.
-
Verify that the
templatePrivatechain state has the newly-shared profile information. Navigate to the Block Explorer and expand thesharedProfileproperty.The
nameandemailfields are populated with the values entered from the Accounts app.The
accountsPrivateandtemplatePrivatechains are now joined. Whenever any updates to the user’s name or email occur in the Accounts app, these changes are automatically reflected in thetemplatePrivatechain. -
Verify that the chain join on the
accountsPrivatechain. From the Block Explorer in the Accounts app, expand thesharedproperty and check that there is an entry with the same profile identifier as in the authorization step.
Congratulations! You have successfully completed this example. To recap, the example has demonstrated:
-
the structure of coordinated Interbit nodes and apps,
-
configuration of nodes and apps,
-
how to start nodes and apps,
-
how those coordinated nodes and apps work in practice.
Now that you have a working example, you have a foundation to tinker and learn further.

















