Open
Description
Description
The endpoint we use for fetching a JWT for iterable is itself behind a jwt authorizer - when this user token expires it is unknown how to pass this change to the generateJWT
function already initialized in iterable.
Code example:
import { initialize } from '@iterable/iterable-web-sdk'
const IterableProvider = () => {
const enabled = useFeatureFlag('iterable')
const { userToken } = useUserToken();
const handler = useCallback(async (request) => fetchJWT(userToken, request), [userToken])
const iterableFunctions = useMemo(() => {
if (enabled) {
initialize(apiKey, handler)
}
}, [enabled])
}
in this scenario when the userToken expires and a new iterable JWT needs to be requested the jwt request will fail because it continues to use the expired token. Other workarounds I've tried are using a ref for the function, calling initialize again when the update happens, but none of these will update the generateJWT method.
Possible solution would just be giving us access to some kind of setGenerateJWT
functionality.
Metadata
Metadata
Assignees
Labels
No labels