Replies: 1 comment
-
Maybe this answer helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
URLRoutingClient
fromswift-url-routing
is quite testable with itsoverride(_:with:)
methods. This makes it very tempting to use directly in a TCA environment, particularly in the new concurrency-beta branch, without the overhead of wrapping. My complication comes when I'd like to integrate OAuth token refreshing functionality.In particular, constructing a live implementation like this would be very cool:
If you're not familiar with the AppAuth library, the
OIDAuthState
object holds your OAuth token. ItsperformAction()
method will either give you your token, or refresh it if necessary. I believe it has some internal synchronization logic to not have more than one refresh request in flight, no matter how many times you call.performAction()
in quick succession.My question isn't about AppAuth per se; you could use any OAuth logic or library of your choice. My question is:
OIDAuthState
won't exist on first launch, or after a logout, so I don't think I can statically configureURLRoutingClient
like this. I understand from discussions elsewhere, eg #721, the environment is supposed to be a static set of dependencies. Does that foreclose abstracting away token logic like this? Ideally, I'd like it to be an implementation detail of the client dependency; I'm not really interested in it vis-à-vis my business logic, at least down in the child features downstream of being logged in.I think I'm approaching this slightly wrong, and would be glad if anyone had any clarifying pointers, or maybe an alternate approach to achieve a similar end. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions