{"action":"closed","issue":{"url":"https://api.github.com/repos/aws-amplify/amplify-js/issues/1974","repository_url":"https://api.github.com/repos/aws-amplify/amplify-js","labels_url":"https://api.github.com/repos/aws-amplify/amplify-js/issues/1974/labels{/name}","comments_url":"https://api.github.com/repos/aws-amplify/amplify-js/issues/1974/comments","events_url":"https://api.github.com/repos/aws-amplify/amplify-js/issues/1974/events","html_url":"https://github.com/aws-amplify/amplify-js/issues/1974","id":373317869,"node_id":"MDU6SXNzdWUzNzMzMTc4Njk=","number":1974,"title":"Best way to persist Auth Credentials during developing app","user":{"login":"hyoungbin","id":18085953,"node_id":"MDQ6VXNlcjE4MDg1OTUz","avatar_url":"https://avatars2.githubusercontent.com/u/18085953?v=4","gravatar_id":"","url":"https://api.github.com/users/hyoungbin","html_url":"https://github.com/hyoungbin","followers_url":"https://api.github.com/users/hyoungbin/followers","following_url":"https://api.github.com/users/hyoungbin/following{/other_user}","gists_url":"https://api.github.com/users/hyoungbin/gists{/gist_id}","starred_url":"https://api.github.com/users/hyoungbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyoungbin/subscriptions","organizations_url":"https://api.github.com/users/hyoungbin/orgs","repos_url":"https://api.github.com/users/hyoungbin/repos","events_url":"https://api.github.com/users/hyoungbin/events{/privacy}","received_events_url":"https://api.github.com/users/hyoungbin/received_events","type":"User","site_admin":false},"labels":[{"id":845261099,"node_id":"MDU6TGFiZWw4NDUyNjEwOTk=","url":"https://api.github.com/repos/aws-amplify/amplify-js/labels/Auth","name":"Auth","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-10-24T06:01:45Z","updated_at":"2018-11-26T19:33:30Z","closed_at":"2018-11-26T19:33:29Z","author_association":"NONE","body":"Hi, I'm trying to build a react-native app with serverless features (cognito, api gateway, s3 etc)\r\n\r\nOn my app, I use only facebook login and google login, and I get cognito credentials like\r\n```\r\nconst FBLogin = async ( ) => {\r\n\r\n... get facebook permissions...\r\n\r\nconst credentials = await Auth.federatedSignIn(\"facebook\", { token, expires_at }, user)\r\n}\r\n```\r\nSo I get cognito credentials when user clicks login button (I made my own button. not built in UI)\r\n(actually not checking whether user is logged in when restart the app. I think this could be a problem.)\r\n\r\nThe Problem is, \r\nwhen I develop my react-native app, I reload a lot to check my code.\r\nBut after reload and trying to fetch some data from api gateway, (my api gateway check cognito identity pool authenticated role for security)\r\neach time I reload my app, credentials deleted and I get error \r\n\r\n> NotAuthorizedException: Unauthenticated access is not supported for this identity pool\r\n\r\nso when I reload my app I have to login again to get credentials.\r\n\r\nin production level, this situation might not be happen, but when developing it is a big problem.\r\nI know there are solutions to fix this, but I don't know how. \r\n\r\nWhat I'm thinking is \r\nSave cognito credentials to local storage or cache, and in `App.js` \r\n```\r\ncomponentDidMount ( ) {\r\n  if not authenticated, then get credential from local storage or cache\r\n}\r\n ```\r\n\r\nnow I'm using\r\n```\r\n \"dependencies\": {\r\n    \"aws-amplify\": \"^1.0.6\",\r\n    \"react\": \"16.4.1\",\r\n    \"react-native\": \"0.56.0\",\r\n    .....\r\n}\r\n```\r\n\r\nWhat is the best way to retain cognito credentials ??\r\n\r\n"}}
{"actor":{"display_login":"powerful23"}}