{"id":20261916,"url":"https://github.com/nodesolidserver/solid-auth-oidc","last_synced_at":"2025-04-11T01:50:59.924Z","repository":{"id":40753513,"uuid":"60299365","full_name":"nodeSolidServer/solid-auth-oidc","owner":"nodeSolidServer","description":"OpenID Connect authentication support for the solid-client library","archived":false,"fork":false,"pushed_at":"2023-04-17T06:39:14.000Z","size":985,"stargazers_count":10,"open_issues_count":11,"forks_count":2,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-04-13T20:52:48.937Z","etag":null,"topics":["running-code"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodeSolidServer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-02T21:42:58.000Z","updated_at":"2024-06-19T04:10:57.673Z","dependencies_parsed_at":"2024-06-19T04:10:32.152Z","dependency_job_id":"44216239-527b-4bc4-8548-d19a840d28e5","html_url":"https://github.com/nodeSolidServer/solid-auth-oidc","commit_stats":null,"previous_names":["solid/solid-auth-oidc"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeSolidServer%2Fsolid-auth-oidc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeSolidServer%2Fsolid-auth-oidc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeSolidServer%2Fsolid-auth-oidc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodeSolidServer%2Fsolid-auth-oidc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodeSolidServer","download_url":"https://codeload.github.com/nodeSolidServer/solid-auth-oidc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328104,"owners_count":21085258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["running-code"],"created_at":"2024-11-14T11:27:38.050Z","updated_at":"2025-04-11T01:50:59.898Z","avatar_url":"https://github.com/nodeSolidServer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# solid-auth-oidc\n[![](https://img.shields.io/badge/project-Solid-7C4DFF.svg?style=flat)](https://github.com/solid/solid)\n[![NPM Version](https://img.shields.io/npm/v/solid-auth-oidc.svg?style=flat)](https://npm.im/solid-auth-oidc)\n\nA Javascript authentication plugin for\n[`solid-client`](https://github.com/solid/solid-client) based on OAuth2/OpenID\nConnect.\n\nThis is an Authentication helper library that wraps an OpenID Connect (OIDC)\nRelying Party library, [`oidc-rp`](https://github.com/anvilresearch/oidc-rp).\nIt is meant to be used in browser-side applications, as part of `solid-client`.\n\n### Usage\n\n##### currentUser\n\n`Promise\u003cstring|null\u003e currentUser()`\n\nResolves to the WebID URI of the currently authenticated user, or `null` if none\nfound.\n\nThis SHOULD be checked either on page load or on whatever \"Application is\nready\" event that your framework provides. For example:\n\n```js\n  // Using a standard \"document loaded\" event listener\n  //  (equivalent to jQuery's $(document).ready())\n  document.addEventListener('DOMContentLoaded', function () {\n    solidClient.currentUser()\n      .then(function (webId) {\n        if (webId) {\n          // User is logged in, you can display their webId, load their profile, etc\n        } else {\n          // Not logged in, display appropriate Login button / UI\n        }\n      })\n      .catch(function (error) {\n        // An error has occurred, display it to user\n      })\n  })\n```\n\n##### login\n\n`Promise\u003cstring|null\u003e login([string providerUri])`\n\nThis is the main \"authenticate to your favorite server/identity provider\"\naction, which can be hooked up to whatever 'Login' button or link that your\nUI provides.\n\nApp developers will use it in one of two ways:\n\na) (typical) Your app does not provide its own Select Provider UI, so you can\n  just call `.login()` by itself with no parameter, which uses the built-in\n  provider selection UI.\nb) Your app *does* provide its own Select Provider UI. In this case, you can\n  perform provider selection and pass in the `providerUri` to `.login()`\n  directly.\n\nCalled by itself (without a `providerUri`), `login()` does the following:\n\n1. If the user has already logged in, it resolves with their WebID URI\n2. Otherwise, opens a 'Select Provider' popup window, asking the user to select\n   their identity provider (Solid server, pod, etc) to login to.\n3. The user makes their selection, and the popup closes and the current page\n   is redirected to that provider's `/authorize` endpoint\n4. When the user has gone through the local login process etc, they are\n   redirected back to the current page (from which `login()` was invoked)\n\nIf `login()` is called *with* a `providerUri` argument, the Select Provider\npopup window step is skipped, and the user proceeds directly to the auth\nworkflow.\n\n```js\n  // You can bind any sort of Login button or link to do the following:\n  solidClient.login()\n    .then(function (webId) {\n      // User is logged in, you can display their webId, load their profile, etc\n    })\n    .catch(function (error) {\n      // An error has occurred while logging in, display it to user\n    })\n```\n\nAfter `login()` is successful, the following variables are set:\n\n- `solidClient.auth.webId` is set to the current user's webId URI\n- `solidClient.auth.accessToken` is set to the current user's access token\n\n##### selectProvider\n\n`Promise\u003cstring\u003e selectProvider ([string providerUri])`\n\n##### logout\n\n`logout()`\n\nClears the current user and tokens, and does a url redirect to the current\nRP client's provider's 'end session' endpoint. A redirect is done (instead of an\najax 'get') to enable the provider to clear any http-only session cookies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesolidserver%2Fsolid-auth-oidc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesolidserver%2Fsolid-auth-oidc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesolidserver%2Fsolid-auth-oidc/lists"}