Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not disconnect and connect when the accessToken is changed #969

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

bang9
Copy link
Contributor

@bang9 bang9 commented Feb 14, 2024

Description

  1. When the accessToken is changed, disconnect and connect are called again.
  2. If the customer controls the accessToken, the session_key refresh performed by the SDK is canceled(API request cancel) due to the disconnect triggered in (1).
  3. Even if the accessToken has already expired, it is refreshed by the SDK(SessionHandler). Therefore, UIKit does not need to rely on this value to handle the connect logic.

ticket: CLNP-2257

@bang9 bang9 added the v3.12.0 label Feb 14, 2024
@bang9 bang9 self-assigned this Feb 14, 2024
Copy link
Contributor

@HoonBaek HoonBaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bang9
Copy link
Contributor Author

bang9 commented Feb 14, 2024

@HoonBaek It might also resolve CLNP-2164, please check with the build of this branch.

@HoonBaek
Copy link
Contributor

@bang9 oh, wow! thank you so much!! let me check it out and resolve it

Copy link
Contributor

@liamcho liamcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this fix been tested/verified?

When SDK fails at session key refresh with below error

err.isSessionTokenExpiredError || err.code === SendbirdErrorCode.APPLICATION_NOT_FOUND

SDK awaits customer callback onSessionTokenRequired response to receive new auth token from customer. However, UIKit does not handle this automatically. Im not sure this is related to removing accessToekn dependency here but customer needs to handle onSessionTokenRequired outside UIKit in their own app. Am I understanding corrrecty?

@liamcho
Copy link
Contributor

liamcho commented Feb 14, 2024

synced offline with above question. There is no problem since UIKit opens configureSession such that customers can handler session events if they use accessToken.

Copy link
Contributor

@liamcho liamcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bang9 bang9 merged commit 3c270dd into main Feb 14, 2024
4 checks passed
@bang9 bang9 deleted the fix/token-refresh-error branch February 14, 2024 06:10
@bang9 bang9 mentioned this pull request Feb 16, 2024
bang9 added a commit that referenced this pull request Feb 20, 2024
## [v3.12.0] (Feb 16, 2024)

### Features:
* Local cache is enabled by default
  * If desired, it can be disabled using sdkInitParams
  ```tsx
  import SendbirdProvider from '@sendbird/uikit-react/SendbirdProvider';
  
  const App = () => (
    <SendbirdProvider
      // ...
      sdkInitParams={{ localCacheEnabled: false }}
    />
  )
  ```
* Added `GroupChannel` and `GroupChannelList` modules.
* With the introduction of `GroupChannel` and `GroupChannelList`, a new
local caching feature has been added, allowing you to experience a more
efficient chat environment.
We provide a massive component called `App` that combines all the
features. From now on, this component will use `GroupChannel` and
`GroupChannelList` instead of `Channel` and `ChannelList`.
If you wish to continue using `Channel` and `ChannelList`, you can use
`enableLegacyChannelModules` to ensure the previous components are still
available for use.
    ```tsx
    import SendbirdApp from '@sendbird/uikit-react/App';
      
    const App = () => (
      <SendbirdApp
        // ...
        enableLegacyChannelModules
      />
    );
    ```
* You can find detailed changes, usage instructions, and migration
methods in the document here: [Migration
Guide](https://github.com/sendbird/sendbird-uikit-react/blob/main/MIGRATION_COLLECTION.md)

### Fixes:

* Fixed a bug where the session refresh failed when the `accessToken`
was changed
[#969](#969)
* Fixed a bug causing infinite loading when the channel is not selected
in the Channel module
[#970](#970)
* Fixed a bug where the mention feature was not functioning properly
[#971](#971)
* Fixed a bug where URLs with numbered top-level domains were treated as
links [#972](#972)
* Fixed a bug where message scroll delays were inconsistently applied
[#975](#975)
* Fixed a bug where `isUserIdUsedForNickname` was not functioning
properly
[#976](#976)
* Optimized the rendering of `SendbirdProvider`
* Optimized the SDK initialization logic for StrictMode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants