Auth
Package | Version | Downloads |
---|---|---|
@carto/react-auth |
This package contains some OAuth utilities for implementing authentication and authorization against the CARTO 2 platform. If you are building an application with CARTO 3, you should use Auth0 React SDK instead of this package.
Components
OAuthCallback
React component to attend OAuth callbacks on /oauthCallback
. Ensure you include that specific route in your application.
Example:
Functions
useOAuthLogin
Hook to perform login against CARTO, with OAuth implicit flow and using a popup.
Input:
Param | Type | Description |
---|---|---|
oauthApp |
| OAuth parameters |
oauthApp.clientId |
| Application client ID |
oauthApp.scopes |
| Scopes to request |
oauthApp.authorizeEndPoint |
| Authorization endpoint |
onParamsRefreshed |
| Function to call when params are refreshed |
Returns:
function
- A function to trigger oauth with a popupExample:
Tip: Check CARTO for React templates for CARTO 2 for examples using this hook, where oauthApp data is managed within Redux store. For example, this is the Login page.
Last updated