Thanks! I can successfully access my name. But the code you provided in Can not access node solid development server localhost returns “Can not read property value of null”
My code:
const { SolidNodeClient } = require("solid-node-client");
const client = new SolidNodeClient();
const $rdf = require("rdflib");
const store = $rdf.graph();
const fetcher = $rdf.fetcher(store,{fetch:client.fetch.bind(client)});
const FoaF = $rdf.Namespace('http://xmlns.com/foaf/0.1');
const VCARD = $rdf.Namespace("http://www.w3.org/2006/vcard/ns#");
const pim = $rdf.Namespace('http://www.w3.org/ns/pim/space#');
router.get("/loginSSI", async function (req, res) {
console.log("done");
try {
console.log("try ");
let ses = await client.login({
idp: YOUR_IDENTITY_PROVIDER, // e.g. https://solidcommunity.net
username: "username",
password: "password",
});
console.log(ses.webId);
const me = $rdf.sym(ses.webId);
console.log("me: ", me);
const profile = $rdf.sym(ses.webId).doc();
console.log("profile: ", profile);
await fetcher.load(profile);
let myPrefs = store.any(me,pim("preferencesFile"));
await fetcher.load(myPrefs);
let mbox = store.any( me , FoaF('mbox'));
console.log("mbox: ",mbox.value); // can not read property 'value' of null
let token = uuidv4();
req.session.token = token;
req.session.save((err) => {
auth.validTokens.push(token);
res.redirect("/");
});
} catch (error) {
console.log(error.message);
}
});