Tutorial
This tutorial creates an introductory application that uses Inrupt’s JavaScript client libraries to:
Login a user.
Reads the Pod URL(s) associated with the user’s WebID. A WebID is a URL that identifies a user and dereferences to the user’s WebID profile document.
Write a reading list to the user’s Pod.
The tutorial uses npm and webpack to run the application locally on http://localhost:8080/ .

Prerequisites
Install npm
If you do not already have npm installed, install npm. npm is installed as part of the Node.js installation.
Inrupt’s Javascript Client libraries support Active/Maintenance LTS releases for Node.js.
To get a WebID and a Pod on PodSpaces :
Go to PodSpaces.
To create an account, you must agree to the Inrupt’s Terms of Service. To agree, select the checkbox.
If you agree to Inrupt’s Terms of Service, click on the Sign Up button.
If you have not registered an account with the Inrupt Identity Provider, click on the Sign up link to create an account:
Fill in your username, email, and password.
Click Sign Up. You are sent a verification email.
Check your email for the verification email. Follow the instructions in the email to verify. Check your spam if you do not see the email in your inbox.
Once verified, return to click Continue to go to the Sign in page:
Enter your username and password.
Click Sign in to your account. The screen displays the access required to continue.
To allow and continue, click Allow. The application displays your WebID and Pod Storage details:
WebID:
https://id.inrupt.com/{username}. Pod Storage:https://storage.inrupt.com/{Root Container}
Build the Application
1. Initialize the Application
Create the directory structure for your Webpack project:
Go to the newly created
my-demo-appdirectory.Initialize the application.
To accept the default values for the application without prompts:
Or, to be prompted to enter values for the application:
You can either hit return to accept the default values (including empty values) or supply your own values.
When prompted
Is this OK? (yes), enter to acceptyes.
2. Install the Client Libraries
Use npm to install the
solid-client,@inrupt/solid-client-authn-browser,vocab-common-rdf, andvocab-solidlibraries:
3. Install Webpack
Use npm to install Webpack packages:
In
my-demo-appdirectory, create awebpack.config.jsfile with the following content:In
my-demo-appdirectory, edit thepackage.jsonfile to addbuildandstartscript fields toscripts:
4. Create the Application
In the my-demo-app directory, create the files for the application. For an explanation of the JavaScript code used in this tutorial, see Explanation
A. Create the CSS File
In the my-demo-app/dist folder, create a my-demo.css file with the following content:
B. Create the HTML File
In the my-demo-app/dist , create an index.html file with the following content:
C. Create the JS File
In the my-demo-app/src , create an index.js file with the following content:
For details about the JavaScript code, see Explanation.
5. Run the Application
In the
my-demo-appdirectory, run:The output resembles the following:
Open
localhost:8080in a browser.Login.
Select the Identity Provider and click Login.
If you have logged out of your Pod, you are prompted to sign in. Enter your username and password and sign in. You will be prompted to allow this application the specified access. To continue, click Continue.
You are redirected back to your page. Your WebID is now displayed in the application.
Click Get Pod URL . The application populates the Pods selection box (in panel 3) with the Pod URL from your profile document.
Write your reading list to your Pod.
Select your Pod URL.
Edit your reading list.
Click Create to to save the list to your Pod.
The reading list is saved to your Pod at https://storage.inrupt.com/<root container>/getting-started/readingList/myList .
Upon successful save, the application displays the saved reading list in the next panel.
For details about the example code, see Explanation
6. Exit the Application
To exit the application, stop the npm run start process; e.g., Ctrl-C .
Additional Information
Last updated