Proof Key for Code Exchange (PKCE) challenge generator for React Native.
Platform | Support |
---|---|
iOS | ๐ข |
Android | ๐ข |
Web | ๐ข |
Windows | ๐ก |
macOS | ๐ข |
Expo | ๐ข |
Node.js | ๐ข |
yarn add react-native-pkce-challenge
npx pod-install ios # iOS Only
npx pod-install macos # macOS Only
import pkceChallenge from 'react-native-pkce-challenge';
const challenge = pkceChallenge();
The constant challenge
will hold an object like the following:
{
codeChallenge: 'XsRstqNrXT76Iop3uMoyyCQmaGthJbKKJwXBSoQXaRk',
codeVerifier: 'OZOHUwLddiPyTFJulnUYnU9jsf7oyULflbFpwj40bE9S77iaeisGvzvaVvvPE7oO-xaV4skxwKDFBBV7JofVNxCgUSauqUDVcVjggE4-M6zthVUmeUrSAHatmIBm_P0_'
}
import { generateChallenge } from 'react-native-pkce-challenge';
generateChallenge(challenge.codeVerifier) === challenge.codeChallenge; // true
import { verifyChallenge } from 'react-native-pkce-challenge';
verifyChallenge(challenge.codeVerifier, challenge.codeChallenge); // true
verifyChallenge(challenge.codeVerifier, 'invalid challenge'); // false
See UPGRADING.md
See CHANGELOGS.md
Copyright ยฉ 2023 David Angulo, released under the MIT license, see LICENSE.