telenordigital / connect-ios-sdk

Docs 📒👉
https://telenordigital.github.io/id-docs.telenordigital.com/integrate-ios-sdk.html
Apache License 2.0
9 stars 8 forks source link

Refresh token for Extension Support #21

Closed thihaaung6245 closed 7 years ago

thihaaung6245 commented 8 years ago

Please take a look,I think your library doesn't support Extension.

http://puu.sh/pLcU6/812fd03008.png

thihaaung6245 commented 8 years ago

I found it.Its because UIApplication.sharedApplication() is only supported inside the app not from the extension.So,can you add support for refreshing token via extension(notification center)?

jorunfa commented 8 years ago

How will your extension handle the situation where no user is signed in? Your extension can't open a Web View or anything like that, so how will you authenticate the user?

thihaaung6245 commented 8 years ago

Yeah,I know that situation.I will control it with NSUserDefault. If the user signed in,the extension will check balance.If not,it will said to open the app and sign in.But,we are talking about refreshing user session right?

From what you explained about requestAccess(),there are 3 conditions.

  • If it is not expired, you will get the one saved in keychain.
  • If it is expired, but you have a refresh token, it will refresh the accessToken for you and give you that.
  • If you don't have an accessToken or a refreshToken (if a user is not signed in) then it will sign in the user and then give you the accessToken.

What I want was the support for first and second condition which doesn't need to appear webview(Connect Sign in View) over UIApplication(Main App) if I am not wrong.

For the third one,it will be error callback.And I will check that error callback and notify the user if he or she need to log in again at Application from Extension.

So,if you can,I mean it was just a suggestion.Would you mind implement another SDK which was only include support for Extension because we all know current connect-ios-sdk won't work with Extension as long as UIApplication.shareApplication() and it's associated method included.

jorunfa commented 8 years ago

Okay, I think I see what you mean. I will need to discuss it with the team here.

thihaaung6245 commented 8 years ago

Thanks for the support!!!! If is there anything you need to know,questions are welcome.

Best Regards