cvat
cvat copied to clipboard
[Dependent] Added force logout on CVAT app start if token is missing
Motivation and context
Before merging this, need to fix getting token from server during social authentication
Sometimes login token can be missing in our browser(cleared local storage). In cvat we use two different types of authentication, so most operations will work good without token(but not all of them). In the future we can implement only one type of authentication, but for now lets force app to keep two methods of authentication.
We run authorized
function when app is starting, here we make request about current user. If it fails with 401
cookies will be automatically reset by server, and then we clear token. If it goes well, then we can be sure that we have correct auth cookies. So then we check token and if its missing, we forcibly logging out a user.
How has this been tested?
Checklist
- [ ] I submit my changes into the
develop
branch - [ ] I have added a description of my changes into CHANGELOG file
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (read github docs)
- [ ] I have increased versions of npm packages if it is necessary (cvat-canvas, cvat-core, cvat-data and cvat-ui)
License
- [ ] I submit my code changes under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.
I am not sure it solves the issue with 3rd party authentification.
After authentification via GitHub I do not have token
in local storage. So, I will automatically logout after updating a page..
@bsekachev , let's wait while @Marishka17 gives us a fix. It is expected tomorrow.
One failed tests because Cypress cannot be downloaded. I will merge the PR.
[FAILED] Platform: linux-x64 (Ubuntu - 20.04)
[FAILED] Cypress Version: 9.7.0
The Cypress App could not be downloaded.
Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
Otherwise, please check network connectivity and try again:
----------
URL: https://download.cypress.io/desktop/9.7.0?platform=linux&arch=x[64](https://github.com/opencv/cvat/actions/runs/3533987992/jobs/5930522631#step:10:65)
Error: Failed downloading the Cypress binary.
Response code: 524
Response message:
----------
Platform: linux-x64 (Ubuntu - 20.04)
Cypress Version: 9.7.0
Error: Process completed with exit code 1.