我正在尝试在我的 React-native 应用程序中保持用户连接。
我在用着 :
"aws-amplify": "1.0.2",
"aws-amplify-react-native": "1.0.2",
"aws-appsync": "^1.3.1",
"aws-appsync-react": "^1.1.1",
"react": "16.4.1",
"react-native": "0.55.4",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-persist": "^5.10.0",
这是我当前的代码:
// AppSync init
const client = new Client({
url: AppSync.graphqlEndpoint,
region: AppSync.region,
auth:{
type: 'AMAZON_COGNITO_USER_POOLS',
jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
},
disableOffline: true
})
我正在使用带有 redux-perist 的默认配置:
const persistConfig = {
key: 'root',
storage,
}
我唯一想要的是在用户重新运行应用程序时从“再水化”存储(由 redux-persist 提供)中检索 jwtToken。
我没有找到有关这些库关联的信息。
希望有人可以帮助我。