{"repo":"bpedroza/js-pkce","free":true,"listed":false,"github":"https://github.com/bpedroza/js-pkce","clone":"git clone https://github.com/bpedroza/js-pkce.git","description":"A package that makes using the OAuth2 PKCE flow easier","language":"TypeScript","stars":39,"topics":["javascript","oauth2","oauth2-client","pkce","js-pkce"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"js-pkce A package that makes using the OAuth2 PKCE flow easier. This package is implemented according to the specification: rfc7636. Use from CDN Since version 1.3.0 this package is available to be used from a CDN: https://cdn.jsdelivr.net/npm/js-pkce/dist/browser.js Explicit version example: https://cdn.jsdelivr.net/npm/js-pkce@1.5/dist/browser.js Installation npm i js-pkce Create a new instance Create a new instance of js-pkce with all of the details needed. Start the authorization process Typically you just need to go to the authorization url to start the process. This example is something that might work in a SPA. You may add additional query parameters to the authorize url by using an optional second parameter: Trade the code for a token After logging in with the authorization server, you will be redirected to the value in the redirect uri parameter you set when creating the instance. Again, this is an example that might work for a SPA. When you get back here, you need to exchange the code for a token. As with the authorizeUrl method, an optional second parameter may be passed to the exchangeForAccessToken method to send additional parameters to the request: Refreshing the token Get a new access token using a refresh token Revoking a token Revoke a token. Note that the specification for this functionality in the context of PKCE is not very well defined. This may not work for all authorization servers. You may optionally pass a token type hint as the second parameter. Cor","default_branch":null,"files":null,"tree":[],"storefront":"/r/bpedroza","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/bpedroza/js-pkce/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}