smart-on-fhir / Swift-SMART

Swift SMART on FHIR framework for iOS and OS X
Other
134 stars 47 forks source link

Asking again credentials while refreshing the Token Using Smart client object. #36

Open ShivamKP-Algoworks opened 3 years ago

ShivamKP-Algoworks commented 3 years ago

Hi I am doing a Cerner login using this library. It's working fine and I am getting the idToken using (smartClient?.server.idToken).

But after 10 min when I am trying to refresh the token I am using the same function i.e. smartClient.authorize(callback: { ( response, err ) in })

but when this method gets called for refreshing the token It's asking us again to entering the Cerner credentials(username, password ) and then updating the token. But that is not correct, It should refresh the idToken or accessToken without asking the credentials again.

And when I am trying to refreshing the token after 9 mins then it's returning the same as previous because it's still a valid token.

So, Is there any way to refresh the token without asking for credentials again?

Thanks in advance !!!

ShivamKP-Algoworks commented 3 years ago

Hi! We are not getting the refresh token that's why it's asking credentials again when we are refreshing the token. So My question is why are we not getting the refresh token?

raheelsayeed commented 2 years ago

Pretty late but–

using smart.ready { } before API call ensures the refresh token being updated, you don't have to call authorize.