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.
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.