{"action":"created","issue":{"url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/130","repository_url":"https://api.github.com/repos/telenordigital/connect-android-sdk","labels_url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/130/comments","events_url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/130/events","html_url":"https://github.com/telenordigital/connect-android-sdk/issues/130","id":353298137,"node_id":"MDU6SXNzdWUzNTMyOTgxMzc=","number":130,"title":"Problem with getValidAccessToken()","user":{"login":"simonnorberg","id":2136645,"node_id":"MDQ6VXNlcjIxMzY2NDU=","avatar_url":"https://avatars2.githubusercontent.com/u/2136645?v=4","gravatar_id":"","url":"https://api.github.com/users/simonnorberg","html_url":"https://github.com/simonnorberg","followers_url":"https://api.github.com/users/simonnorberg/followers","following_url":"https://api.github.com/users/simonnorberg/following{/other_user}","gists_url":"https://api.github.com/users/simonnorberg/gists{/gist_id}","starred_url":"https://api.github.com/users/simonnorberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonnorberg/subscriptions","organizations_url":"https://api.github.com/users/simonnorberg/orgs","repos_url":"https://api.github.com/users/simonnorberg/repos","events_url":"https://api.github.com/users/simonnorberg/events{/privacy}","received_events_url":"https://api.github.com/users/simonnorberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-08-23T09:26:17Z","updated_at":"2018-09-18T13:13:56Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We call `ConnectSdk.getValidAccessToken(AccessTokenCallback callback)` in `onResume()` in our launch activity to check if we are logged in with ConnectID. If we get a `onSuccess()` callback we assume that we are logged in and have a valid IdToken. However, this is not always the case. Sometimes `ConnectSdk.getIdToken().getSerializedSignedJwt()` and `ConnectSdk.getIdToken().getSubject()` returns null if we call them in the AccessTokenCallback onSuccess.\r\n\r\nIs this working as intended? Our understanding is that if we have a valid access token we should always have an IdToken? Is there a recommended way to verify that a user is logged in?\r\n\r\nWe are using version 1.7.1."},"comment":{"url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/comments/422388062","html_url":"https://github.com/telenordigital/connect-android-sdk/issues/130#issuecomment-422388062","issue_url":"https://api.github.com/repos/telenordigital/connect-android-sdk/issues/130","id":422388062,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjM4ODA2Mg==","user":{"login":"jorunfa","id":1413275,"node_id":"MDQ6VXNlcjE0MTMyNzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1413275?v=4","gravatar_id":"","url":"https://api.github.com/users/jorunfa","html_url":"https://github.com/jorunfa","followers_url":"https://api.github.com/users/jorunfa/followers","following_url":"https://api.github.com/users/jorunfa/following{/other_user}","gists_url":"https://api.github.com/users/jorunfa/gists{/gist_id}","starred_url":"https://api.github.com/users/jorunfa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorunfa/subscriptions","organizations_url":"https://api.github.com/users/jorunfa/orgs","repos_url":"https://api.github.com/users/jorunfa/repos","events_url":"https://api.github.com/users/jorunfa/events{/privacy}","received_events_url":"https://api.github.com/users/jorunfa/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T13:13:56Z","updated_at":"2018-09-18T13:13:56Z","author_association":"COLLABORATOR","body":"Sorry for the slow reply... we're trying to hire more people so we can be less busy.\r\nI think your two scenarios are close to equivalent, except in example 2, it should be `!= null` instead of `== null`.\r\n\r\nif\r\n`if (ConnectSdk.getAccessToken() != null)` is called then you have a signed in user (since there are tokens).\r\n\r\nOne other thing:\r\n`ConnectSdk.handleRedirectUriCallIfPresent` calls `ConnectSdk.hasValidRedirectUrlCall` internally, so you don't need to wrap it in that. `ConnectSdk.hasValidRedirectUrlCall` was originally meant to be a helper for setting UI element state (like showing a loading spinner while the no-UI network call for exchanging authorization code for access and refresh tokens runs)."}}
{"actor":{"display_login":"jorunfa"}}