/react-native-pkce-challenge

Proof Key for Code Exchange (PKCE) challenge generator for React Native.

Primary LanguageJavaScriptMIT LicenseMIT

React Native PKCE Challenge

Package version MIT license PRs Welcome

Proof Key for Code Exchange (PKCE) challenge generator for React Native.

API Compatibility

Method iOS Android Web Windows macOS Expo
asyncPkceChallenge
pkceChallenge

Installation

yarn add react-native-pkce-challenge
npx pod-install # iOS Only

Installation (Expo)

expo install react-native-pkce-challenge expo-random buffer
npx pod-install # iOS Only

💡 If you use the Expo managed workflow you will see "CocoaPods is not supported in this project" - this is fine, it's not necessary.

Usage

Asynchronous (Recommended)

import { asyncPkceChallenge } from 'react-native-pkce-challenge';

const challenge = await asyncPkceChallenge();

Synchronous

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_'
}

Upgrading

See UPGRADING.md

Changelogs

See CHANGELOGS.md

Contributing

See CONTRIBUTING.md

License

Copyright © 2022 David Angulo, released under the MIT license, see LICENSE.