Home Page: Site selection often doesn't work after first selection

Issue #184 resolved
Trek Hopton created an issue

It seems that the site selection menu works when you first log in but after a period of time, it no longer lets you effectively select another site. You will be able to click a site but if you navigate away eg. to the search page, the selection will not have taken effect.

To fix the issue you have to log out then log back in again.

This behaviour was noticed after a recent change which made the sessions longer. I would guess that this bug is related to that change. See PR #186.

Comments (7)

  1. Trek Hopton reporter

    I have found that selecting the site produces error:

    2022-07-12 02:56:25 default[7]  "GET /api/set/site/301235661931 HTTP/1.1" 403
    

  2. Trek Hopton reporter

    The error on line 102 of api.go is not reported to the logs so this makes it hard to debug the ‘Forbidden’ http code.

  3. Trek Hopton reporter

    I started a branch to log some errors that were ambiguous but I haven’t got to the root of the problem. Leaving it for now. The branch is auth-errs.

  4. Saxon Milton

    That error is occurring because the token has expired. When we get the profile, there is mechanism to check whether or not the token is valid. If it is not valid, the token is refreshed, or so we thought. While the code does refresh the token and provide a fresh client, the new token is not stored in tok (even though it’s a pointer), so the refreshed token is not actually saved when the session is saved. Then, when we try to “put data” (site key data) for the profile, the same stale token is used and the token invalid error is thrown. The problem code btw is actually in iotsvc; I’m going to open an issue for this.

  5. Log in to comment