{"library":"solid-auth-cli","title":"Solid Command-Line Authentication Client","type":"library","description":"solid-auth-cli is a Node.js and command-line client library designed to facilitate persistent authentication with Solid Pods. It provides an API that mirrors solid-auth-client, enabling scripts to function in both browser (via solid-auth-client) and server-side/CLI environments (via solid-auth-cli) with minimal code changes. The current stable version is 1.0.15. While a specific release cadence isn't detailed, its versioning suggests a mature and stable 1.x branch. A key differentiator is its support for persistent logins using configuration files or environment variables, making it ideal for automated scripts or server-side applications that interact with Solid resources. It also offers a custom fetch implementation that can be integrated with rdflib.js (version 0.19.1 or newer) for graph data manipulation, or used directly for fetching resources via standard REST APIs, allowing programmatic interaction with the Solid ecosystem.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install solid-auth-cli"],"cli":{"name":"solid-auth-cli","version":null}},"imports":["const auth = require('solid-auth-cli')","auth.login()","auth.fetch(resource)"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/solid-auth-cli","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const solid = { auth:require('solid-auth-cli') }\nconst resource = \"https://example.com/private/hidden.ttl\" // Replace with your Solid Pod resource\nconst expected = \"only the owner\"\n\nconsole.log(\"logging in ...\")\nlogin().then( session => {\n    console.log(`logged in as <${session.webId}>`)\n    solid.auth.fetch(resource).then( response => {\n        if (!response.ok) console.log(response.status+\" \"+response.statusText)\n        response.text().then( content => {\n            if( content.match(new RegExp(expected)) ) console.log(\"ok: content matches expected pattern.\")\n            else console.log(\"Got something, but not the right thing.\")\n        },e => console.log(\"Error parsing : \"+e))\n    },e => console.log(\"Error fetching : \"+e))\n},e => console.log(\"Error logging in : \"+e))\n\nasync function login() {\n    // This example attempts a silent login from a previous session, then prompts if needed.\n    // For a non-interactive script, ensure credentials are set via env vars or config file.\n    var session = await solid.auth.currentSession()\n    if (!session) {\n        // You would typically configure IDP, username, password via env vars or a config file for CLI usage\n        session = await solid.auth.login() // Will attempt to read ~/.solid-auth-cli-config.json or env vars\n    }\n    return session;\n}","lang":"javascript","description":"This quickstart demonstrates how to log in persistently, fetch an authenticated resource from a Solid Pod, and check its content.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}