![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
ra-cognito-auth
Advanced tools
AWS Cognito auth provider for react-admin.
npm install ra-cognito-auth amazon-cognito-identity-js-promises aws-jwt-verify
Build auth provider and pass it to the react admin.
Example:
import { CognitoUserPool } from 'amazon-cognito-identity-js-promises';
import { buildCognitoAuthProvider } from 'ra-cognito-auth';
import jsonServerProvider from 'ra-data-json-server';
import { Admin, ListGuesser, Resource } from 'react-admin';
const dataProvider = jsonServerProvider('https://jsonplaceholder.typicode.com');
const userPool: CognitoUserPool = new CognitoUserPool({
UserPoolId: 'myUserPool',
ClientId: 'myClientId',
});
const authProvider = buildCognitoAuthProvider({ userPool });
export const App = () => (
<Admin dataProvider={dataProvider} authProvider={authProvider}>
<Resource name="users" list={ListGuesser} />
</Admin>
);
Get access token from the cognito pool to authorize api calls:
// calling `getSession()` will also refresh token if needed
const session = await userPool.getCurrentUser()?.getSession();
const accessToken = session?.getAccessToken().getJwtToken();
If you would like to verify the JWT instead of just checking the validity of the session, pass a configured cognito jwt verifier to the build function. The JWT token from the session is then verified against the verifier during the checkAuth method of the provider.
Example with validating if the user has an admin group:
// ...
const cognitoJwtVerifier = CognitoJwtVerifier.create({
tokenUse: 'access',
userPoolId: 'myUserPool',
clientId: 'myClientId',
groups: ['admin'],
});
const authProvider = buildCognitoAuthProvider({ userPool, cognitoJwtVerifier });
// ...
FAQs
Cognito auth provider for react-admin
We found that ra-cognito-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.