πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
DemoInstallSign in
Socket

react-native-app-auth

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-app-auth

React Native bridge for AppAuth for supporting any OAuth 2 provider

1.0.0
Source
npm
Version published
Weekly downloads
160K
32.02%
Maintainers
1
Weekly downloads
Β 
Created

What is react-native-app-auth?

The react-native-app-auth package is a React Native bridge for the AppAuth-iOS and AppAuth-Android SDKs for communicating with OAuth 2.0 and OpenID Connect providers. It allows developers to authenticate users and obtain access tokens for accessing protected resources.

What are react-native-app-auth's main functionalities?

Authorization Code Flow

This feature allows you to perform the Authorization Code Flow, which is a common OAuth 2.0 flow for obtaining access tokens. The code sample demonstrates how to configure the authorization request and handle the response.

{
  "import": "import { authorize } from 'react-native-app-auth';",
  "config": "const config = {\n  issuer: 'https://accounts.google.com',\n  clientId: 'YOUR_CLIENT_ID',\n  redirectUrl: 'com.yourapp:/oauth2redirect',\n  scopes: ['openid', 'profile']\n};",
  "authorize": "authorize(config).then(result => console.log(result)).catch(error => console.error(error));"
}

Token Refresh

This feature allows you to refresh an access token using a refresh token. The code sample shows how to use the refresh function to obtain a new access token.

{
  "import": "import { refresh } from 'react-native-app-auth';",
  "refreshToken": "refresh(config, { refreshToken: 'YOUR_REFRESH_TOKEN' }).then(result => console.log(result)).catch(error => console.error(error));"
}

Revoke Token

This feature allows you to revoke an access or refresh token. The code sample demonstrates how to revoke a token using the revoke function.

{
  "import": "import { revoke } from 'react-native-app-auth';",
  "revokeToken": "revoke(config, { tokenToRevoke: 'YOUR_ACCESS_TOKEN', sendClientId: true }).then(() => console.log('Token revoked')).catch(error => console.error(error));"
}

Other packages similar to react-native-app-auth

Keywords

react

FAQs

Package last updated on 23 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts