-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match new provider auth signatures v3 #148
Comments
I just implemented your library with react-admin v3: import React from 'react';
import ReactDOM from 'react-dom';
import { Admin, Resource } from 'react-admin';
import { restClient, authClient } from 'ra-data-feathers';
import client from './feathers';
import './index.css';
import reportWebVitals from './reportWebVitals';
import { PostalCodeList } from './resources/postal-codes';
const restClientOptions = {
id: '_id', // In this example, the database uses '_id' rather than 'id'
usePatch: true // Use PATCH instead of PUT for updates
};
const authClientOptions = {
usernameField: 'email',
passwordField: 'password',
// permissionsField: 'userroles',
// redirectTo: '/signin',
}
ReactDOM.render(
<Admin
dataProvider={restClient(client, restClientOptions)}
authProvider={authClient(client, authClientOptions)}
>
<Resource
name="postal-codes"
list={PostalCodeList}
/>
</Admin>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals(); The login process works (the authenticate method is successful) but I am immediately logged out just after that. Is that related to this issue? |
This basic and not complete custom implementation works: const authProvider: AuthProvider = {
login: (params) => client.authenticate({
strategy: 'local',
email: params.username,
password: params.password,
}),
logout: () => client.logout().then(() => Promise.resolve()),
checkAuth: () => client
.reAuthenticate()
.then(() => Promise.resolve())
.catch(() => Promise.reject({ redirectTo: '/login' })),
checkError: () => Promise.resolve(),
getPermissions: () => Promise.resolve(),
} |
I dont understand if there is any error using react.-admin v3. |
I'm having trouble getting this to work. Does anyone have a more complete working example? I tried swapping out the authClient from here #146 but I keep getting the same error: `client.logout is not a function." |
I dont understand what are you needing. Can you explain a little more? |
According to the v3 blog react admin changed its auth provider signature.
@FacundoMainere Has done a WIP on this
To be done:
We still need to be retrocompatible with react-admin v2 (last release just one year ago) and still need to make tests match current signatures.
The text was updated successfully, but these errors were encountered: