Matrix SDK get list of messages

Viewed 418

I'm trying to call to get API of matrix client in order to get all the list of the messages from server.

let token = this.matrixClient.store.syncToken
      axios.get(`https://matrix.org/_matrix/client/r0/rooms/${this.roomId}/messages`, {from: token}).then((res) => {
        console.log(res)
      }).catch(err => {
        console.log(err)
      })

Response with 401 (network tab)

{errcode: "M_MISSING_TOKEN", error: "Missing access token"}
errcode: "M_MISSING_TOKEN"
error: "Missing access token"

Can anyone please elaborate with an example here

0 Answers
Related