Skip to content

Releases: FormidableLabs/react-native-app-auth

v2.1.0

21 Feb 12:44
Compare
Choose a tag to compare

Big thanks to @janpieterz, @PeterKottas, @jevakallio and @kitten for help on this release 🎉

  • Add typescript definitions #49
  • Allow insecure http requests (useful for testing) on Android #50
  • Friendlier error messages in example app #48

New API

09 Feb 15:51
Compare
Choose a tag to compare

Improved API

Read all about it in the issue and relevant PR.

The main difference is that instead of instantiating an AppAuth class and having to keep track of it, you can now just use each of the methods: authorize, refresh and revoke directly, override their config when necessary and provide additional method-specific configuration.

Before

import AppAuth from 'react-native-app-auth';

const config = {
  issuer: '<YOUR_ISSUER_URL>',
  redirectUrl: '<YOUR_REDIRECT_URL>',
  clientId: '<YOUR_CLIENT_ID>'
};
const appAuth = new AppAuth(config);

// authorize
const scopes = '<YOUR_SCOPES_ARRAY>';
const result = await appAuth.authorize(scopes);

// refresh
const scopes = '<YOUR_SCOPES_ARRAY>';
const result = await appAuth.refresh(scopes);

// revoke
const tokenToRevoke = '<TOKEN_TO_REVOKE>';
const sendClientId = '<BOOLEAN>';
const result = await appAuth.revokeToken(tokenToRevoke, sendClientId = false);

After

import { authorize, refresh, revoke } from 'react-native-app-auth';

const config = {
  issuer: '<YOUR_ISSUER_URL>',
  redirectUrl: '<YOUR_REDIRECT_URL>',
  clientId: '<YOUR_CLIENT_ID>',
  scopes: '<YOUR_SCOPES_ARRAY>'
};

// authenticate
const result = await authorize(config);

// refresh
const result = await refresh(config, {
  refreshToken: result.refreshToken,
});

// revoke
const result = await revoke(config, {
  tokenToRevoke: result.accessToken,
  sendClientId: '<BOOLEAN>'
});

Bugfixes

  • Fixed Example App Release Build #20
  • Exposed missing parameters form token request #34

Enhancements

  • Added Okta and Keycloak instructions to the Readme #22
  • Enable passing additionalParameters to the auth request #33
  • Our amazing new Logo ❤️#39