{"id":17215443,"url":"https://github.com/pixtron/oidc-appauth","last_synced_at":"2026-01-21T10:01:39.468Z","repository":{"id":42923657,"uuid":"244455758","full_name":"pixtron/oidc-appauth","owner":"pixtron","description":"oidc-appauth is a client SDK for public javascript clients (node cli, electron apps), following the best practices defined in RFC 8252.","archived":false,"fork":false,"pushed_at":"2022-12-30T19:47:25.000Z","size":199,"stargazers_count":1,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-25T11:48:05.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pixtron.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}},"created_at":"2020-03-02T19:22:36.000Z","updated_at":"2022-11-10T14:48:17.000Z","dependencies_parsed_at":"2023-01-31T15:01:23.528Z","dependency_job_id":null,"html_url":"https://github.com/pixtron/oidc-appauth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pixtron/oidc-appauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Foidc-appauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Foidc-appauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Foidc-appauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Foidc-appauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pixtron","download_url":"https://codeload.github.com/pixtron/oidc-appauth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixtron%2Foidc-appauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-15T03:24:27.788Z","updated_at":"2026-01-21T10:01:39.401Z","avatar_url":"https://github.com/pixtron.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oidc-appauth\n\noidc-appauth is a client SDK for [public javascript clients](https://tools.ietf.org/html/rfc6749#section-2.1)\nfor authenticating against [OpenId Connect](https://openid.net/specs/openid-connect-core-1_0.html) providers,\nfollowing the best practices defined in [RFC 8252 - OAuth 2.0 for Native Apps](https://tools.ietf.org/html/rfc8252).\n\nThe library only supports the recommended authorization code flow with [PKCE](https://tools.ietf.org/html/rfc7636).\nIt is not planed to add other authorization flows.\n\nThe library is designed to be used in `Node.js` cli applications and applications that use `electron` or similar node based frameworks.\n\n## Installation\n\n`npm install --save @pxtrn/oidc-appauth`\n\n## Examples\n\nThere is a `Node.js` example in [`src/node-example.ts`](src/node-example.ts).\n\n### Initialize the client\n\n```ts\nimport { Client } from '@pxtrn/oidc-appauth'\n\nconst credentials = {\n  client_id: 'YOUR CLIENT ID',\n  redirect_uri: 'http://127.0.0.1:8000'\n}\n\nconst client = new Client(credentials, 'https://accounts.google.com')\n```\n\nIf the provider url is passed the client will get the provider configuration from the `.well-known/openid-configuration` endpoint.\nYou might also directly pass a provider configuration ([ProviderConfigurationI](src/provider-configuration/provider-configuration.ts))\n\n\n### Authentication Request\n\n```ts\nimport { AuthenticationRequestI } from '@pxtrn/oidc-appauth'\n\nconst request: AuthenticationRequestI = {\n  scope: 'openid'\n}\n\nconst authResponse = await client.performAuthenticationRequest(request)\n\nconst responseType = authResponse.getType()\n\nswitch (responseType) {\n  case AuthenticationResponse.AUTHENTICATION_SUCCESS:\n    // a Successful Authentication Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#AuthResponse\n    console.log('Got authentication response', authResponse)\n  case AuthenticationResponse.AUTHENTICATION_ERROR:\n    // an Authentication Error Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n    console.log('Got authentication error response', authResponse.getResponse())\n    break\n  case AuthenticationResponse.AUTHENTICATION_INVALID:\n    // Neither a valid Successfull Autentication Response nor a valid Authentication Error Response\n    console.log('Got authentication invalid response', authResponse.getResponse())\n    break\n}\n```\n\n\n### Exchange authorization code for token\n\n```ts\nimport { TokenResponse } from '@pxtrn/oidc-appauth'\n\n//authResponse from [Authentication Request](#authentication-request)\nconst response = await client.exchangeCodeForToken(authResponse)\n\nconst responseType = response.getType()\n\nswitch (responseType) {\n  case TokenResponse.RESPONSE_SUCCESS:\n    // an oidc Token Success Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#TokenSuccessResponse\n    console.log('Got token response', response.getResponse())\n  case TokenResponse.RESPONSE_ERROR:\n    // an oidc Token Error Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#TokenErrorResponse\n    console.log('Got token error response', response.getResponse())\n    break\n  case TokenResponse.RESPONSE_INVALID:\n    // neither a valid Token Success Response nor a valid Token Error Response\n    console.log('Got invalid token response', response.getResponse())\n    break\n}\n```\n\n\n### Refresh access token\n\n```ts\nimport { TokenResponse } from '@pxtrn/oidc-appauth'\n\n// refreshToken from previous TokenResponse\nconst response = await client.refreshToken(refreshToken)\n\nconst responseType = response.getType()\n\nswitch (responseType) {\n  case TokenResponse.RESPONSE_SUCCESS:\n    // an oidc Token Success Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#TokenSuccessResponse\n    console.log('Got token response', response.getResponse())\n  case TokenResponse.RESPONSE_ERROR:\n    // an oidc Token Error Response as defined in https://openid.net/specs/openid-connect-core-1_0.html#TokenErrorResponse\n    console.log('Got token error response', response.getResponse())\n    break\n  case TokenResponse.RESPONSE_INVALID:\n    // neither a valid Token Success Response nor a valid Token Error Response\n    console.log('Got invalid token response', response.getResponse())\n    break\n}\n```\n\n### Revoke access token\n\n```ts\nimport { RevokeTokenResponse } from '@pxtrn/oidc-appauth'\n\nconst response = await client.revokeToken(token, 'access_token')\n\nconst responseType = response.getType()\n\nswitch (responseType) {\n  case RevokeTokenResponse.RESPONSE_SUCCESS:\n    // a Revocation Response as defined in https://tools.ietf.org/html/rfc7009#section-2.2\n    return response\n  case RevokeTokenResponse.RESPONSE_RETRY:\n    // a Error Response (503) as defined in https://tools.ietf.org/html/rfc7009#section-2.2.1\n    console.log('Got revoke token retry response', response.getResponse())\n    break\n  case RevokeTokenResponse.RESPONSE_ERROR:\n    // a Error Response (400) as defined in https://tools.ietf.org/html/rfc7009#section-2.2.1\n    console.log('Got revoke token error response', response.getResponse())\n    break\n  case RevokeTokenResponse.RESPONSE_INVALID:\n    // neither a valid Revocation Response nor a valid Error Response\n    console.log('Got invalid revoke token response', response.getResponse())\n    break\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixtron%2Foidc-appauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixtron%2Foidc-appauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixtron%2Foidc-appauth/lists"}