Hello everyone. I am new to solid. I’ve been trying to integrate ExpressJS with node solid client using node-solid-client. But when I use the development node solid server using localhost, express can not access the https://localhost:8443 . I am uploading my express server on Docker. My Code is given below
console.log("done");
try {
console.log("try ")
let ses = await client.login({
idp: YOUR_IDENTITY_PROVIDER, // e.g. https://localhost:8443
username: "my username",
password: "my password",
});
console.log(ses.isLoggedIn);
return res.send("hi");
} catch (error) {
console.log(error.message);
}
Instead, it prints the console and ses.isLoggedIn returns false. But if I use https://solidcommunity.net , it works. What could be the error here? Can anybody help please?
My console:
Solidcommunity.net is using v5.6.6. Are you using the same version? Do you have version 2.0.5 of solid-node-client? I can’t see enough of the log to figure anything out, can you show more?
I have an account on SolidCommunity.net just. I am using solid-node-client 2.0.4. Actually, my error logs nothing shows more than the screenshot I provided in the post. Another thing, I am running my express server on Docker . My route:
Ah, I just though of something - have you set solid-node-client as a trustedApp on your localhhost? You’ll need to use the databrowser on the localhost and set https://solid-node-client as a trustedApp. Let me know if that fixes it for you.
Did you mean requiring the node-solid-client part? If that’s the case, I also tested solid community pod. Authentication works just fine. But in the case of my local host, solid server pod doesn’t work. As I’ve given my code and the console part, you can see there isn’t any essential information about the error on the console.
Well, that looks fine. Maybe, instead of redirecting in your test code above, try to read or write a private file. Perhaps isLoggedIn is giving a false negative.
Off topic, sorry. Not sure if I should ask this in another discussion post. Instead local host I’ve added solid community as pod temporarily. Now I have my webID. How can I retrieve my profile information from webID using solid-node-client? I’ve tried installing rdflib but rdflib is giving error with nodejs 10 in which I am currently working on.
OH! There are several other needed libraries in addition to rdflib that require a minimum of node 12. I’m afraid your only option is to upgrade your node.
Here’s how to retrieve a profile from a WebID using Solid-Node-Client:
/* Follow-Your-Nose (traversal)
----------------------------
opens a profile
finds the prefernces file in the profile
opens the preferences file
finds the preferred mailbox in the preferences file
*/
import {SolidNodeClient} from 'solid-node-client';
let client = new SolidNodeClient();
import * as $rdf from 'rdflib';
const kb = $rdf.graph();
const fetcher = $rdf.fetcher(kb,{fetch:client.fetch.bind(client)});
const webid = "https://jeff-zucker.solidcommunity.net/profile/card#me";
const profile = $rdf.sym(webid).doc();
const me = $rdf.sym(webid);
const foaf = $rdf.Namespace('http://xmlns.com/foaf/0.1/');
const pim = $rdf.Namespace('http://www.w3.org/ns/pim/space#');
async function main(){
await client.login(); // grabs credentials from environ vars
await fetcher.load(profile);
let myPrefs = kb.any( me, pim('preferencesFile') );
await fetcher.load(myPrefs);
let mbox = kb.any( me,foaf('mbox'));
console.log(mbox.value);
}
main();
Oh…Thank you very much. But how can solve this problem mentioned before. A note, I am accessing localhost:8443 from docker.Is there any issue for this?
Hi! About local NSS. I am not sure about the installation of NSS on my PC. I want to install solid on development environment . That’s why I am using self-signed certificates. I followed Solid server Running in development environments section. Now any specific action I should be concerned about?I followed these steps:
cloned the NSS into my pc.
generated self-signed certificates
in NSS directory, followed commands to setup server
@jeffz I just noticed that when I started my local NSS pod, it shows “auth-method: oidc”. But I am not using any oidc token. Now I want to try without oidc. How should I proceed?
My screenshot: