{"id":15619794,"url":"https://github.com/jpalumickas/node-oauth2-server-model-prisma","last_synced_at":"2025-04-28T17:41:15.776Z","repository":{"id":41256682,"uuid":"297385092","full_name":"jpalumickas/node-oauth2-server-model-prisma","owner":"jpalumickas","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-05T21:24:21.000Z","size":272,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-25T02:01:57.440Z","etag":null,"topics":["node","nodejs","oauth","oauth2","oauth2-server","prisma","prisma-client","prisma2"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/jpalumickas.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-21T15:40:21.000Z","updated_at":"2025-02-20T19:36:16.000Z","dependencies_parsed_at":"2022-07-10T03:18:15.268Z","dependency_job_id":null,"html_url":"https://github.com/jpalumickas/node-oauth2-server-model-prisma","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpalumickas%2Fnode-oauth2-server-model-prisma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpalumickas%2Fnode-oauth2-server-model-prisma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpalumickas%2Fnode-oauth2-server-model-prisma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpalumickas%2Fnode-oauth2-server-model-prisma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpalumickas","download_url":"https://codeload.github.com/jpalumickas/node-oauth2-server-model-prisma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251357455,"owners_count":21576710,"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":["node","nodejs","oauth","oauth2","oauth2-server","prisma","prisma-client","prisma2"],"created_at":"2024-10-03T08:41:40.166Z","updated_at":"2025-04-28T17:41:15.754Z","avatar_url":"https://github.com/jpalumickas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prisma model for node OAuth2 Server\n\n## Installation\n\nUsing Yarn\n```sh\nyarn add oauth2-server-model-prisma\n```\n\nUsing NPM\n\n```sh\nnpm install oauth2-server-model-prisma\n```\n\n## Usage\n\n```js\n  import model from 'oauth2-server-model-prisma';\n\n  const server = new OAuth2Server({\n    model: {\n      ...model({ prisma }),\n    },\n    requireClientAuthentication: {\n      password: false,\n      refresh_token: false,\n    },\n  });\n```\n\n### Prisma Schema\n```groovy\n\nmodel OauthAccessToken {\n  id                    String           @default(dbgenerated()) @id\n  userId                String\n  applicationId         String\n  token                 String           @unique\n  refreshToken          String?          @unique\n  tokenExpiresAt        DateTime?        @db.Timestamptz(6)\n  refreshTokenExpiresAt DateTime?        @db.Timestamptz(6)\n  scopes                Json             @default(\"[]\")\n  createdAt             DateTime         @default(now()) @db.Timestamptz(6)\n  updatedAt             DateTime         @default(now()) @updatedAt @db.Timestamptz(6)\n  application           OauthApplication @relation(fields: [applicationId], references: [id])\n  user                  User             @relation(fields: [userId], references: [id])\n\n  @@index([applicationId])\n  @@index([userId])\n}\n\nmodel OauthAccessGrant {\n  id            String           @default(dbgenerated()) @id\n  userId        String\n  applicationId String\n  token         String           @unique\n  expiresAt     DateTime         @db.Timestamptz(6)\n  redirectUri   String\n  codeChallengeMethod String?\n  codeChallenge String?\n  scopes        Json             @default(\"[]\")\n  createdAt     DateTime         @default(now()) @db.Timestamptz(6)\n  updatedAt     DateTime         @default(now()) @updatedAt @db.Timestamptz(6)\n  application   OauthApplication @relation(fields: [applicationId], references: [id])\n  user          User             @relation(fields: [userId], references: [id])\n\n  @@index([applicationId])\n  @@index([userId])\n}\n\nmodel OauthApplication {\n  id           String             @default(dbgenerated()) @id\n  name         String\n  clientId     String             @unique\n  clientSecret String\n  redirectUris Json               @default(\"[]\")\n  scopes       Json               @default(\"[]\")\n  createdAt    DateTime           @default(now()) @db.Timestamptz(6)\n  updatedAt    DateTime           @default(now()) @updatedAt @db.Timestamptz(6)\n  grants       Json               @default(\"[]\")\n  accessTokens OauthAccessToken[]\n  accessGrants OauthAccessGrant[]\n}\n\nmodel User {\n  id                String             @default(dbgenerated()) @id\n  name              String\n  email             String             @unique\n  encryptedPassword String\n  createdAt         DateTime           @default(now()) @db.Timestamptz(6)\n  updatedAt         DateTime           @default(now()) @updatedAt @db.Timestamptz(6)\n  accessTokens      OauthAccessToken[]\n  accessGrants      OauthAccessGrant[]\n  identities        UserIdentity[]\n}\n\nmodel UserIdentity {\n  id        String   @default(dbgenerated()) @id\n  userId    String\n  provider  String\n  uid       String\n  name      String?\n  email     String?\n  createdAt DateTime @default(now()) @db.Timestamptz(6)\n  updatedAt DateTime @default(now()) @updatedAt @db.Timestamptz(6)\n  user      User     @relation(fields: [userId], references: [id])\n\n  @@index([userId])\n  @@unique([provider, uid])\n}\n```\n\n## License\n\nThe package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n[oauth2-server]: https://github.com/oauthjs/node-oauth2-server\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpalumickas%2Fnode-oauth2-server-model-prisma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpalumickas%2Fnode-oauth2-server-model-prisma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpalumickas%2Fnode-oauth2-server-model-prisma/lists"}