Missing Authorization headers after login success
See original GitHub issueI flow the sample chat app. and integrating react-admin with my feathers app but it always on the login page. the code looks like this
import React from ‘react’; import { Admin, Resource } from ‘react-admin’; import feathersClient from ‘./feathersClient’; import { PostList, PostEdit, PostCreate } from ‘./messages’; import { restClient, authClient } from ‘ra-data-feathers’;
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 ={ storageKey: ‘token’, // The key in localStorage used to store the authentication token authenticate: { // Options included in calls to Feathers client.authenticate strategy: ‘local’, // The authentication strategy Feathers should use header:‘Authorization’, }, permissionsKey: ‘permissions’, // The key in localStorage used to store permissions from decoded JWT permissionsField: ‘roles’, // The key in the decoded JWT containing the user’s role passwordField: ‘password’, // The key used to provide the password to Feathers client.authenticate usernameField: ‘email’, // The key used to provide the username to Feathers client.authenticate }
const App = () => { return ( <Admin title=‘ra-data-feathers Example’ dataProvider={restClient(feathersClient, restClientOptions)} authProvider={authClient(feathersClient, authClientOptions)}
<Resource name="messages" list={PostList} edit={PostEdit} create={PostCreate} /> </Admin> )};export default App;
**Response error message:
{"name":"NotAuthenticated","message":"No auth token","code":401,"className":"not-authenticated","data":{},"errors":{}}
**
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I fixed it by adding storage:localStorage option to my feathers client
For me it was fixed by adding ‘feathers-jwt’ as the storageKey name in my auth client options since is the default that the feathers auth client uses.