Hi guys,
I encountered no callback from app.authenticate
npm setup:
"@feathersjs/authentication-client": "^1.0.8",
"@feathersjs/feathers": "^3.2.3",
"@feathersjs/primus-client": "^1.1.6",
"@feathersjs/socketio-client": "^1.1.5",
"socket.io-client": "^2.1.1"
feathers.js setup:
import io from 'socket.io-client';
import feathers from '@feathersjs/feathers';
import socketio from '@feathersjs/socketio-client';
import authentication from '@feathersjs/authentication-client';
const socket = io('http://192.168.0.148:3030/');
const app = feathers();
app.configure(socketio(socket));
app.configure(authentication({
storage: window.localStorage
}));
export default app;
By the way, app.service('model').find() works fine.
Is there any thing I'm missing?
tried with this setup:
https://github.com/feathersjs-ecosystem/feathers-localstorage/issues/16
but still not working
Hi guys,
I think this has to be related to AsyncStorage from react-native itself.
Somehow, I able to get it work by below feathers setup:
import io from 'socket.io-client';
import feathers from '@feathersjs/feathers';
import socketio from '@feathersjs/socketio-client';
import auth from '@feathersjs/authentication-client';
import { AsyncStorage } from "react-native"
const socket = io('http://192.168.0.148:3030/');
const app = feathers();
app.configure(socketio(socket));
app.configure(auth({ storage: AsyncStorage }));
export default app;
Reopen because after authenticate successfully, hitting 'No auth token'
Still looking for solution
I am facing the same issue
Please upgrade to the latest version and provide a complete example to reproduce if you are still facing the same issue.
hi @daffl
after updating to latest version:
"@feathersjs/authentication-client": "^4.4.1",
"@feathersjs/feathers": "^4.4.1",
"@feathersjs/socketio-client": "^4.4.1",
"socket.io-client": "^2.3.0",
"react-native": "0.61.5",
"react": "16.9.0",
Still not working
Below is my feathers.js setup:
import io from 'socket.io-client';
import feathers from '@feathersjs/feathers';
import socketio from '@feathersjs/socketio-client';
import auth from '@feathersjs/authentication-client';
import { AsyncStorage } from "react-native"
const socket = io('http://192.168.0.118:3030/');
const client = feathers();
client.configure(socketio(socket));
client.configure(auth({
storage: AsyncStorage,
}));
export default client;
My App.js:
client.authenticate({
strategy: 'facebook',
access_token: token
})
.then((res)=>{
return client.service('users').find()
})
.then((res)=>{
console.log({res})
})
.catch((err)=>{
console.log({err})
})
This still giving me the error "No auth token"
By the way, I tried to use the returned token with axios, it works:
client.authenticate({
strategy: 'facebook',
access_token: token
})
.then((res)=>{
return axios.get(`http://192.168.0.118:3030/users`,
{
headers:
{
'Authorization': res.accessToken
}
}
)
})
.then((res)=>{
console.log({res})//data returned from feathersjs server
})
.catch((err)=>{
console.log({err})
})
@daffl
Do I need to have the latest version of feathers npm on my api as well?
My current api package.json
"@feathersjs/authentication": "^2.1.16",
"@feathersjs/authentication-jwt": "^2.0.10",
"@feathersjs/authentication-local": "^1.2.9",
"@feathersjs/authentication-oauth2": "^1.3.1",
"@feathersjs/cli": "^3.9.0",
"@feathersjs/configuration": "^2.0.6",
"@feathersjs/errors": "^3.3.6",
"@feathersjs/express": "^1.3.1",
"@feathersjs/feathers": "^3.3.1",
"@feathersjs/socketio": "^3.2.9",
"express": "^4.16.4",
"feathers-authentication": "^1.3.1",
"feathers-authentication-hooks": "^0.3.1",
"feathers-hooks-common": "^4.20.7",
"feathers-mongoose": "^6.3.0",
@co2nut Yes you should, look at the upgrade guide here.
The last version is 4.4.1.