{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-amplify/issues/483","repository_url":"https://api.github.com/repos/aws/aws-amplify","labels_url":"https://api.github.com/repos/aws/aws-amplify/issues/483/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-amplify/issues/483/comments","events_url":"https://api.github.com/repos/aws/aws-amplify/issues/483/events","html_url":"https://github.com/aws/aws-amplify/issues/483","id":306974045,"number":483,"title":"Auth.currentCredentials and Auth.currentSession returns nothing on startup for 0.2.10 onward","user":{"login":"xdl","id":4680342,"avatar_url":"https://avatars1.githubusercontent.com/u/4680342?v=4","gravatar_id":"","url":"https://api.github.com/users/xdl","html_url":"https://github.com/xdl","followers_url":"https://api.github.com/users/xdl/followers","following_url":"https://api.github.com/users/xdl/following{/other_user}","gists_url":"https://api.github.com/users/xdl/gists{/gist_id}","starred_url":"https://api.github.com/users/xdl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdl/subscriptions","organizations_url":"https://api.github.com/users/xdl/orgs","repos_url":"https://api.github.com/users/xdl/repos","events_url":"https://api.github.com/users/xdl/events{/privacy}","received_events_url":"https://api.github.com/users/xdl/received_events","type":"User","site_admin":false},"labels":[{"id":708993526,"url":"https://api.github.com/repos/aws/aws-amplify/labels/bug","name":"bug","color":"ee0701","default":true},{"id":772762686,"url":"https://api.github.com/repos/aws/aws-amplify/labels/investigating","name":"investigating","color":"006b75","default":false}],"state":"open","locked":false,"assignee":{"login":"richardzcode","id":1006903,"avatar_url":"https://avatars3.githubusercontent.com/u/1006903?v=4","gravatar_id":"","url":"https://api.github.com/users/richardzcode","html_url":"https://github.com/richardzcode","followers_url":"https://api.github.com/users/richardzcode/followers","following_url":"https://api.github.com/users/richardzcode/following{/other_user}","gists_url":"https://api.github.com/users/richardzcode/gists{/gist_id}","starred_url":"https://api.github.com/users/richardzcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardzcode/subscriptions","organizations_url":"https://api.github.com/users/richardzcode/orgs","repos_url":"https://api.github.com/users/richardzcode/repos","events_url":"https://api.github.com/users/richardzcode/events{/privacy}","received_events_url":"https://api.github.com/users/richardzcode/received_events","type":"User","site_admin":false},"assignees":[{"login":"richardzcode","id":1006903,"avatar_url":"https://avatars3.githubusercontent.com/u/1006903?v=4","gravatar_id":"","url":"https://api.github.com/users/richardzcode","html_url":"https://github.com/richardzcode","followers_url":"https://api.github.com/users/richardzcode/followers","following_url":"https://api.github.com/users/richardzcode/following{/other_user}","gists_url":"https://api.github.com/users/richardzcode/gists{/gist_id}","starred_url":"https://api.github.com/users/richardzcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardzcode/subscriptions","organizations_url":"https://api.github.com/users/richardzcode/orgs","repos_url":"https://api.github.com/users/richardzcode/repos","events_url":"https://api.github.com/users/richardzcode/events{/privacy}","received_events_url":"https://api.github.com/users/richardzcode/received_events","type":"User","site_admin":false},{"login":"powerful23","id":11042868,"avatar_url":"https://avatars1.githubusercontent.com/u/11042868?v=4","gravatar_id":"","url":"https://api.github.com/users/powerful23","html_url":"https://github.com/powerful23","followers_url":"https://api.github.com/users/powerful23/followers","following_url":"https://api.github.com/users/powerful23/following{/other_user}","gists_url":"https://api.github.com/users/powerful23/gists{/gist_id}","starred_url":"https://api.github.com/users/powerful23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerful23/subscriptions","organizations_url":"https://api.github.com/users/powerful23/orgs","repos_url":"https://api.github.com/users/powerful23/repos","events_url":"https://api.github.com/users/powerful23/events{/privacy}","received_events_url":"https://api.github.com/users/powerful23/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-03-20T17:52:29Z","updated_at":"2018-03-26T18:34:51Z","closed_at":null,"author_association":"NONE","body":"In version 0.2.9, we were able to check the user's login status by calling `Auth.currentCredentials()` and checking if they have `expired`. If they have, we can redirect the user into the login page, using something like:\r\n\r\n```\r\nconstructor() {\r\n    Amplify.Auth.currentCredentials().then((result) => {\r\n      if (result && !result.expired) {\r\n          this.authState = \"SignedIn\";\r\n        });\r\n      } else {\r\n        this.authState = \"SignIn\";\r\n      }\r\n  })\r\n}\r\n```\r\n\r\nAfter upgrading to 0.2.10 and 0.2.11, the callback value for this (and `currentSession`) no longer return anything. However, later calls return the appropriate value, suggesting that there is some sort of timing issue involved.\r\n\r\nIs this a regression, or the intended behaviour? If it is the latter, what would be the suggested way of checking whether the user's logged on when they first land on the app?"},"comment":{"url":"https://api.github.com/repos/aws/aws-amplify/issues/comments/376267507","html_url":"https://github.com/aws/aws-amplify/issues/483#issuecomment-376267507","issue_url":"https://api.github.com/repos/aws/aws-amplify/issues/483","id":376267507,"user":{"login":"powerful23","id":11042868,"avatar_url":"https://avatars1.githubusercontent.com/u/11042868?v=4","gravatar_id":"","url":"https://api.github.com/users/powerful23","html_url":"https://github.com/powerful23","followers_url":"https://api.github.com/users/powerful23/followers","following_url":"https://api.github.com/users/powerful23/following{/other_user}","gists_url":"https://api.github.com/users/powerful23/gists{/gist_id}","starred_url":"https://api.github.com/users/powerful23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powerful23/subscriptions","organizations_url":"https://api.github.com/users/powerful23/orgs","repos_url":"https://api.github.com/users/powerful23/repos","events_url":"https://api.github.com/users/powerful23/events{/privacy}","received_events_url":"https://api.github.com/users/powerful23/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T18:34:51Z","updated_at":"2018-03-26T18:34:51Z","author_association":"CONTRIBUTOR","body":"@Larsrdev Can you give a try on aws-amplify@beta to see if it works for you? From the debug log I think the problem is that the credentials is not loaded when you call this method which should be fixed in the beta version."}}
{"actor":{"display_login":"powerful23"}}