为Android构建时FeathersJS登录错误
我正在使用Ionic构建一个Android应用程序。并使用以下feathers\u client.js 当我在浏览器上运行应用程序时,它工作正常。但当我在安卓设备上运行它时,我只得到“未认证” 我假设这是因为FeatherJS将JWT令牌存储在window.localStorage中,而这在Android应用程序用户空间中不可用 两个问题: 1) 有没有办法告诉FeathersJS将此令牌存储在其他地方 2) 如果没有,是否有人面临这种情况,并可以为我提供解决方案 顺便说一下,这是我的身份验证代码:为Android构建时FeathersJS登录错误,android,jwt,feathersjs,jwt-auth,Android,Jwt,Feathersjs,Jwt Auth,我正在使用Ionic构建一个Android应用程序。并使用以下feathers\u client.js 当我在浏览器上运行应用程序时,它工作正常。但当我在安卓设备上运行它时,我只得到“未认证” 我假设这是因为FeatherJS将JWT令牌存储在window.localStorage中,而这在Android应用程序用户空间中不可用 两个问题: 1) 有没有办法告诉FeathersJS将此令牌存储在其他地方 2) 如果没有,是否有人面临这种情况,并可以为我提供解决方案 顺便说一下,这是我的身份验证代
export class SSHSettingsPage implements OnInit {
public inputEmail: string;
public inputPassword: string;
constructor() { }
ngOnInit() {
}
public performLogin($event) {
let authObj: object = { "strategy": "local", "email": this.inputEmail, "password": this.inputPassword};
client.authenticate(authObj)
.then(res => {
console.log(res);
window.localStorage.setItem("user",JSON.stringify(res.user));
window.location.href = "/download";
})
.catch(err => {
console.log(err);
window.location.href = "/login-error";
})
}
}
如存储
中所述,可以向选项传递以下内容的实例:
如存储
中所述,可以向选项传递以下内容的实例:
export class SSHSettingsPage implements OnInit {
public inputEmail: string;
public inputPassword: string;
constructor() { }
ngOnInit() {
}
public performLogin($event) {
let authObj: object = { "strategy": "local", "email": this.inputEmail, "password": this.inputPassword};
client.authenticate(authObj)
.then(res => {
console.log(res);
window.localStorage.setItem("user",JSON.stringify(res.user));
window.location.href = "/download";
})
.catch(err => {
console.log(err);
window.location.href = "/login-error";
})
}
}
import {AsyncStorage} from 'react-native';
// Available options are listed in the "Options" section
app.configure(auth({
storage: AsyncStorage
}))