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

OAuth2Module: enable access tokens to be refreshed concurrently #60

Open ts95 opened 5 years ago

ts95 commented 5 years ago

In the previous implementation, if the refreshAccessToken method were called while a token refresh was already in progress, the call would fail and the refresh token would be set to nil, effectively signing the user out.

This patch introduces a queue which makes sure that any successive refresh calls will wait for the first call to finish before returning a result.

Comments in OAuth2Module.swift further explain how it works.

I tried adding a test to OAuth2ModuleTests, but the existing tests failed and I couldn't figure out why since I didn't get any errors. Apart from that I've tested this since yesterday on multiple devices and it's working flawlessly.

jorunfa commented 5 years ago

Thanks for the PR 💪! We will review it properly as soon as we can.