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

Add token to header in Http request and handle unauthorised errors #102 #135

Merged
merged 8 commits into from
May 12, 2024

Conversation

Haaaan1
Copy link
Contributor

@Haaaan1 Haaaan1 commented May 7, 2024

  1. Add request interceptors in api.js to add token in header
  2. Handle unauthorised error in lobby

@Haaaan1 Haaaan1 requested a review from petertheprocess May 7, 2024 12:03
@Haaaan1
Copy link
Contributor Author

Haaaan1 commented May 7, 2024

Please check the handle error method.

@Haaaan1 Haaaan1 requested a review from Zehao-Zhang May 7, 2024 12:16
@petertheprocess
Copy link
Contributor

petertheprocess commented May 9, 2024

 stompClientRef.current?.send(
      `/app/message/users/enterroom/${currentRoomID}`,
      { receiptId: receiptId,
        token: token // add this token for every send method to support authentication
      },

      JSON.stringify(payload)
    );

@Haaaan1 @Zehao-Zhang

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
15.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Contributor

@yixuan-zhou-uzh yixuan-zhou-uzh left a comment

Choose a reason for hiding this comment

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

Token check before entering a room seems unreachable.

@Haaaan1 Haaaan1 merged commit 9533eee into dev May 12, 2024
2 of 3 checks passed
@petertheprocess petertheprocess deleted the feature-authentication branch May 24, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants