{"id":19410118,"url":"https://github.com/nicolasdao/userin-core","last_synced_at":"2026-06-13T02:02:44.596Z","repository":{"id":57388716,"uuid":"293964443","full_name":"nicolasdao/userin-core","owner":"nicolasdao","description":"UserIn core component used to build UserIn plugins.","archived":false,"fork":false,"pushed_at":"2020-10-13T11:03:06.000Z","size":1577,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-14T21:20:17.426Z","etag":null,"topics":["federated-identity-providers","oauth2","oidc","userin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicolasdao.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-09T00:58:46.000Z","updated_at":"2023-12-12T11:05:42.000Z","dependencies_parsed_at":"2022-09-19T02:30:43.056Z","dependency_job_id":null,"html_url":"https://github.com/nicolasdao/userin-core","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasdao%2Fuserin-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasdao%2Fuserin-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasdao%2Fuserin-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasdao%2Fuserin-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolasdao","download_url":"https://codeload.github.com/nicolasdao/userin-core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240587852,"owners_count":19825061,"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":["federated-identity-providers","oauth2","oidc","userin"],"created_at":"2024-11-10T12:14:53.317Z","updated_at":"2026-06-13T02:02:39.566Z","avatar_url":"https://github.com/nicolasdao.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# userin-core \u0026middot; [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\nUserIn core component to build an OAuth 2.0 OpenID Connect web API that supports integration with the most popular Federated Identity Providers (e.g., Google, Facebook, GitHub)\n\n```\nnpm i userin-core\n```\n\n# Table of contents\n\n\u003e * [Create a new UserIn Strategy](#create-a-new-userin-strategy)\n\u003e * [Utilities](#utilities)\n\u003e\t- [`token.id_token.addDateClaims(claims: Object[, expiryInSeconds: Number])`](#tokenid_tokenadddateclaimsclaims-object-expiryinseconds-number)\n\n# Create a new UserIn Strategy\n\n```js\nconst { Strategy } = require('userin-core')\n\nclass CustomStrategy extends Strategy {\n\tconstructor() {\n\t\tsuper()\n\t\tthis.name = 'yourcustomstrategy'\n\t\tthis.generate_token = (root, { type, claims }) =\u003e { /* Implement your logic here */ }\n\t\tthis.get_client = (root, { client_id, client_secret }) =\u003e { /* Implement your logic here */ }\n\t\tthis.get_end_user = (root, { user }) =\u003e { /* Implement your logic here */ }\n\t\tthis.get_fip_user = (root, { strategy, user }) =\u003e { /* Implement your logic here */ }\n\t\tthis.get_identity_claims = (root, { user_id, scopes }) =\u003e { /* Implement your logic here */ }\n\t\tthis.get_token_claims = (root, { type, token }) =\u003e { /* Implement your logic here */ }\n\t}\n}\n```\n\nTo facilitate custom implementation, we've added a template [here](https://gist.github.com/nicolasdao/a17f575a65ddad166d51aa7e78e41be7).\n\n# Utilities\n## `token.id_token.addDateClaims(claims: Object[, expiryInSeconds: Number])`\n\n`expiryInSeconds` is optional. Its default value is `3600` seconds.\n\n```js\nconst { token } = require('userin-core')\n\nconst claims = { iss:'https://example.com', first_name:'Nic', last_name:'Dao' }\n\nconsole.log(token.id_token.addDateClaims(claims, 3600))\n\n// Prints:\n// {\n// \t\tiss:'https://example.com', \n// \t\tfirst_name:'Nic', \n// \t\tlast_name:'Dao',\n// \t\tiat: 1600148277,\n// \t\texp: 1600151877\n// }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasdao%2Fuserin-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasdao%2Fuserin-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasdao%2Fuserin-core/lists"}