{"id":22489295,"url":"https://github.com/bpedroza/js-pkce","last_synced_at":"2026-02-14T20:10:43.072Z","repository":{"id":39185223,"uuid":"247199118","full_name":"bpedroza/js-pkce","owner":"bpedroza","description":"A package that makes using the OAuth2 PKCE flow easier","archived":false,"fork":false,"pushed_at":"2025-09-17T14:43:19.000Z","size":1107,"stargazers_count":37,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-21T02:58:16.494Z","etag":null,"topics":["javascript","js-pkce","oauth2","oauth2-client","pkce"],"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/bpedroza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-14T02:40:18.000Z","updated_at":"2025-09-17T14:43:15.000Z","dependencies_parsed_at":"2024-06-18T18:34:53.514Z","dependency_job_id":"4126b485-61bc-4bd7-a714-87935ec4eb89","html_url":"https://github.com/bpedroza/js-pkce","commit_stats":{"total_commits":60,"total_committers":7,"mean_commits":8.571428571428571,"dds":0.4,"last_synced_commit":"12d14f097ade2ba027858e422761d64a36f98762"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/bpedroza/js-pkce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpedroza%2Fjs-pkce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpedroza%2Fjs-pkce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpedroza%2Fjs-pkce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpedroza%2Fjs-pkce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpedroza","download_url":"https://codeload.github.com/bpedroza/js-pkce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpedroza%2Fjs-pkce/sbom","scorecard":{"id":249729,"data":{"date":"2025-08-11","repo":{"name":"github.com/bpedroza/js-pkce","commit":"5880a410a9791b21bc6d60a594365530d995897a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/7 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/run-tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run-tests.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bpedroza/js-pkce/run-tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run-tests.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/bpedroza/js-pkce/run-tests.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":1,"reason":"branch protection is not maximal on development and all release branches","details":["Warn: branch protection not enabled for branch '1.x'","Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'master'","Warn: PRs are not required to make changes on branch 'master'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T08:13:27.443Z","repository_id":39185223,"created_at":"2025-08-17T08:13:27.443Z","updated_at":"2025-08-17T08:13:27.443Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29454999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["javascript","js-pkce","oauth2","oauth2-client","pkce"],"created_at":"2024-12-06T17:19:35.465Z","updated_at":"2026-02-14T20:10:43.053Z","avatar_url":"https://github.com/bpedroza.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"![Build Status](https://github.com/bpedroza/js-pkce/actions/workflows/run-tests.yml/badge.svg)\n\n# js-pkce\nA package that makes using the OAuth2 PKCE flow easier.\n\nThis package is implemented according to [the specification: rfc7636](https://datatracker.ietf.org/doc/html/rfc7636).\n\n## Use from CDN\nSince version 1.3.0 this package is available to be used from a CDN:\n\nhttps://cdn.jsdelivr.net/npm/js-pkce/dist/browser.js\n\nExplicit version example:\n\nhttps://cdn.jsdelivr.net/npm/js-pkce@1.5/dist/browser.js\n\n## Installation\n`npm i js-pkce`\n\n## Create a new instance\nCreate a new instance of js-pkce with all of the details needed.\n\n```javascript\nimport PKCE from 'js-pkce';\nconst pkce = new PKCE({\n  client_id: 'myclientid',\n  redirect_uri: 'http://localhost:8080/auth',\n  authorization_endpoint: 'https://authserver.com/oauth/authorize',\n  token_endpoint: 'https://authserver.com/oauth/token',\n  revoke_endpoint: 'https://authserver.com/oauth/revoke', // optional\n  requested_scopes: '*',\n  storage: sessionStorage // optional\n});\n```\n\n## Start the authorization process\nTypically you just need to go to the authorization url to start the process.\nThis example is something that might work in a SPA.\n\n```javascript\nwindow.location.replace(pkce.authorizeUrl());\n```\n\nYou may add additional query parameters to the authorize url by using an optional second parameter:\n\n```javascript\nconst additionalParams = {test_param: 'testing'};\nwindow.location.replace(pkce.authorizeUrl(additionalParams));\n```\n\n## Trade the code for a token\nAfter logging in with the authorization server, you will be redirected to the value in\nthe `redirect_uri` parameter you set when creating the instance.\nAgain, this is an example that might work for a SPA.\n\nWhen you get back here, you need to exchange the code for a token.\n\n```javascript\nconst url = window.location.href;\npkce.exchangeForAccessToken(url).then((resp) =\u003e {\n  const token = resp.access_token;\n  // Do stuff with the access token.\n});\n```\n\nAs with the authorizeUrl method, an optional second parameter may be passed to\nthe `exchangeForAccessToken` method to send additional parameters to the request:\n\n```javascript\nconst url = window.location.href;\nconst additionalParams = {test_param: 'testing'};\n\npkce.exchangeForAccessToken(url, additionalParams).then((resp) =\u003e {\n  const token = resp.access_token;\n  // Do stuff with the access token.\n});\n```\n\n## Refreshing the token\nGet a new access token using a refresh token\n\n```javascript\npkce.refreshAccessToken(refreshToken).then((resp) =\u003e {\n  const accessToken = resp.access_token;\n  const refreshToken = resp.refresh_token;\n  // Do stuff with the access \u0026 refresh token.\n});\n```\n\n## Revoking a token\nRevoke a token. Note that the specification for this functionality in the context of PKCE\nis not very well defined. This may not work for all authorization servers.\n\nYou may optionally pass a `token_type_hint` as the second parameter.\n\n```javascript\npkce.revokeToken(tokenToExpire, 'access_token')\n```\n\n## Cors credentials\nWhen using httpOnly cookies, there is some additional configuration required. The method \n`enableCorsCredentials` can be called to allow sending credentials.\n\n```javascript\npkce.enableCorsCredentials(true);\n```\n\n## A note on Storage\nBy default, this package will use `sessionStorage` to persist the `pkce_state`. On (mostly) mobile\ndevices there's a higher chance users are returning in a different browser tab. E.g. they kick off\nin a WebView \u0026 get redirected to a new tab. The `sessionStorage` will be empty there.\n\nIn this case it you can opt in to use `localStorage` instead of `sessionStorage`:\n\n```javascript\nimport PKCE from 'js-pkce';\nconst pkce = new PKCE({\n  // ...\n  storage: localStorage, // any Storage object, sessionStorage (default) or localStorage \n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpedroza%2Fjs-pkce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpedroza%2Fjs-pkce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpedroza%2Fjs-pkce/lists"}