Hi. I’m using Sendbird UIKit React in my Next.js-based application. During the initialization of SendbirdProvider
, I pass the appId
, userId
, and accessToken
. Unfortunately, the accessToken
is only available after the app has loaded, when I read the userId
from the user’s cookies and send a request to the backend to get the accessToken
. This causes several issues in the application. My current implementation looks like this:
import SBProvider from '@sendbird/uikit-react/SendbirdProvider';
type Props = {
children: React.ReactNode;
appId: string;
userId: string;
accessToken?: string;
};
export const SendbirdProvider = ({ children, userId, appId, accessToken }: Props) => {
return accessToken ? (
<SBProvider appId={appId} userId={userId} accessToken={accessToken}>
{children}
</SBProvider>
) : (
children
);
};
Is it possible to initialize SendbirdProvider
without the accessToken
and update the token later once it becomes available?
"next": "15.2.3"
"@sendbird/chat": "4.19.1"
"@sendbird/uikit-react": "3.16.9"