introduce custom local storage support and error handling for getUserInfo
Introduce a new storage option in hookConfig that allows a custom local storage to be passed into logtoClient. This will supersede the default CookieStorage for storing session and token data. If a custom storage is provided, the cookieConfig settings can be disregarded.
Add a new onGetUserInfoError callback in hookConfig for custom error handling when getUserInfo or getIdTokenClaims operations fail. By default, a 500 server error will be thrown.
This PR will address the following feedbacks from the Logto community:
Large cookie exception if a large number of tokens are cached.
Unable to catch the error thrown by the getUserInfo flow in the handleLogto method.
Summary
introduce custom local storage support and error handling for getUserInfo
Introduce a new
storage
option inhookConfig
that allows a custom local storage to be passed intologtoClient
. This will supersede the defaultCookieStorage
for storing session and token data. If a customstorage
is provided, thecookieConfig
settings can be disregarded.Add a new
onGetUserInfoError
callback inhookConfig
for custom error handling whengetUserInfo
orgetIdTokenClaims
operations fail. By default, a 500 server error will be thrown.This PR will address the following feedbacks from the Logto community:
getUserInfo
flow in thehandleLogto
method.Testing
test lcoally
Checklist
.changeset