Sara Herz
Sara Herz

Reputation: 1

How to integrate aws-amplify authentication with react-admin?

I'm having problems integrating the authentication with aws amplify. First, I have this code in the authprovider of the admin-react, but I'm not sure how could I implement this with aws amplify.

import { AuthProvider } from 'react-admin';

const authProvider: AuthProvider = {
    login: ({ username }) => {
        localStorage.setItem('username', username);
        // accept all username/password combinations
        return Promise.resolve();
    },
    logout: () => {
        localStorage.removeItem('username');
        return Promise.resolve();
    },
    checkError: () => Promise.resolve(),
    checkAuth: () =>
        localStorage.getItem('username') ? Promise.resolve() : Promise.reject(),
    getPermissions: () => Promise.reject('Unknown method'),
    getIdentity: () =>
        Promise.resolve({
            id: 'user',
            fullName: 'Admin Name',
        }),
};

export default authProvider;

Upvotes: 0

Views: 364

Answers (1)

Margalit
Margalit

Reputation: 397

try the following auth provider https://github.com/MrHertal/react-admin-amplify

Upvotes: 2

Related Questions