How to use the react-native-app-auth.revoke function in react-native-app-auth

To help you get started, we’ve selected a few react-native-app-auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github forest-watcher / forest-watcher / app / redux-modules / user.js View on Github external
return async (dispatch: Dispatch, state: GetState) => {
    const { oAuthToken: tokenToRevoke, socialNetwork } = state().user;
    dispatch({ type: LOGOUT_REQUEST });
    dispatch({ type: RESET_STATE });

    try {
      await CookieManager.clearAll();

      const social = socialNetwork || socialNetworkFallback;
      switch (social) {
        case 'google': {
          if (tokenToRevoke) {
            await revoke(oAuth.google, { tokenToRevoke });
          }
          break;
        }
        case 'facebook':
          await LoginManager.logOut();
          break;
        default:
          break;
      }
      return dispatch({ type: SET_LOGIN_STATUS, payload: true });
    } catch (e) {
      console.error(e);
      return dispatch({ type: SET_LOGIN_STATUS, payload: false });
    }
  };
}
github zzorba / ArkhamCards / lib / auth.ts View on Github external
return getRefreshToken().then(refreshToken => {
      if (refreshToken) {
        revoke(config, { tokenToRevoke: refreshToken });
      }
    });
  }, () => {
github oktadeveloper / okta-react-native-app-auth-example / App.js View on Github external
revoke = async () => {
    try {
      await revoke(config, {
        tokenToRevoke: this.state.accessToken,
        sendClientId: true
      });
      this.animateState({
        accessToken: '',
        accessTokenExpirationDate: '',
        refreshToken: '',
        beers: []
      });
    } catch (error) {
      Alert.alert('Failed to revoke token', error.message);
    }
  };
github FormidableLabs / react-native-app-auth / Example / AndroidExample / App.js View on Github external
revoke = async () => {
    try {
      await revoke(config, {
        tokenToRevoke: this.state.accessToken,
        sendClientId: true,
      });
      this.animateState({
        accessToken: '',
        accessTokenExpirationDate: '',
        refreshToken: '',
      });
    } catch (error) {
      Alert.alert('Failed to revoke token', error.message);
    }
  };
github FormidableLabs / react-native-app-auth / Example / iOSCarthageExample / App.js View on Github external
revoke = async () => {
    try {
      await revoke(config, {
        tokenToRevoke: this.state.accessToken,
        sendClientId: true
      });
      this.animateState({
        accessToken: '',
        accessTokenExpirationDate: '',
        refreshToken: ''
      });
    } catch (error) {
      Alert.alert('Failed to revoke token', error.message);
    }
  };

react-native-app-auth

React Native bridge for AppAuth for supporting any OAuth 2 provider

MIT
Latest version published 9 days ago

Package Health Score

93 / 100
Full package analysis