flaky-noon-11399
06/20/2025, 8:31 AMcalm-dog-24239
06/20/2025, 8:50 AMflaky-noon-11399
06/20/2025, 9:14 AMcalm-dog-24239
06/20/2025, 7:04 PMtokenProvider
and an onTokenExpired
callback directly through the GrowthBookBuilder
initializer, like this:
GrowthBookBuilder(
...
tokenProvider: {
return TokenStorage.shared.token
},
onTokenExpired: {
TokenStorage.shared.updateToken()
}
)
This will allow the SDK to automatically include the provided token in all requests, and to handle 401 Unauthorized
responses by invoking the refresh callback and retrying the request with a new token.flaky-noon-11399
06/23/2025, 10:09 AMcalm-dog-24239
06/25/2025, 6:47 AMonTokenExpired
callback to refresh the token when needed, and also the ability to provide any additional headers required for your use case.
We chose this approach to give users full flexibility in how they manage their authentication logic β since token handling can vary significantly across implementations. When a 401
response is detected, the onTokenExpired
callback is triggered, allowing you to plug in any custom token refresh logic that fits your infrastructure.
This should serve as a robust workaround for authenticated requests and simplify retry handling tied to token expiration.
Let us know if you have any feedback or further requirements!flaky-noon-11399
06/25/2025, 6:19 PMcalm-dog-24239
06/25/2025, 6:23 PM