easyauth icon indicating copy to clipboard operation
easyauth copied to clipboard

401 Unauthorized - When loging in for the first time on admin

Open singlautsav opened this issue 2 years ago • 2 comments

I installed the easy-auth with pip install easy-auth[server] has a missing dependancy 'aiosqlite'. When I run the main file I and head onto /login page it throws the error as below

Error Log

  • INFO: Application startup complete.
  • INFO: 127.0.0.1:56843 - "GET /login HTTP/1.1" 200 OK
  • INFO: 127.0.0.1:56844 - "POST /login HTTP/1.1" 302 Found
  • 07-26 15:37 EasyRpc-server /ws/manager WARNING global_store_update - update - tokens - 9a71e09f-da83-406d-9d29-c55473b056ee
  • INFO: 127.0.0.1:56844 - "GET /admin/ HTTP/1.1" 401 Unauthorized
  • INFO: 127.0.0.1:56870 - "GET / HTTP/1.1" 200 OK
  • INFO: 127.0.0.1:56870 - "GET /admin/ HTTP/1.1" 401 Unauthorized
  • INFO: 127.0.0.1:56899 - "POST /login HTTP/1.1" 302 Found
  • 07-26 15:38 EasyRpc-server /ws/manager WARNING global_store_update - update - tokens - 7c984e1c-1416-430d-acc0-aae1095dcb00
  • INFO: 127.0.0.1:56899 - "GET /admin/ HTTP/1.1" 401 Unauthorized

Pip Freeze Output aiohttp==3.8.5 aiosignal==1.3.1 aiosmtplib==2.0.2 aiosqlite==0.19.0 alembic==1.8.1 annotated-types==0.5.0 anyio==3.7.1 async-timeout==4.0.2 attrs==23.1.0 bcrypt==4.0.1 blinker==1.6.2 cachetools==5.3.1 certifi==2023.7.22 cffi==1.15.1 charset-normalizer==3.2.0 click==8.1.6 cryptography==41.0.2 databases==0.5.3 Deprecated==1.2.14 dnspython==2.4.0 easy-auth==2.0.1 easyadmin==0.170 easyrpc==0.245 easyschedule==0.107 email-validator==1.1.3 example==0.1.0 exceptiongroup==1.1.2 fastapi==0.100.0 fastapi-mail==1.3.1 frozenlist==1.4.0 google-api-core==2.11.1 google-api-python-client==2.31.0 google-auth==2.22.0 google-auth-httplib2==0.1.0 googleapis-common-protos==1.59.1 gunicorn==20.1.0 h11==0.14.0 httpcore==0.17.3 httplib2==0.22.0 httptools==0.3.0 httpx==0.24.1 idna==3.4 itsdangerous==2.1.2 Jinja2==3.1.2 jwcrypto==1.5.0 makefun==1.9.5 Mako==1.2.4 MarkupSafe==2.1.3 multidict==6.0.4 orjson==3.9.2 protobuf==4.23.4 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycparser==2.21 pydantic==1.10.12 pydantic-extra-types==2.0.0 pydantic-settings==2.0.2 pydantic_core==2.4.0 pydbantic==0.0.41 PyJWT==2.0.0 pyparsing==3.1.0 python-dotenv==1.0.0 python-jwt==4.0.0 python-multipart==0.0.6 PyYAML==6.0.1 redis==4.6.0 requests==2.31.0 rsa==4.9 six==1.16.0 sniffio==1.3.0 SQLAlchemy==1.4.28 starlette==0.27.0 typing_extensions==4.7.1 ujson==5.8.0 uritemplate==4.1.1 urllib3==1.26.16 uvicorn==0.23.1 uvloop==0.17.0 watchfiles==0.19.0 websockets==11.0.3 wrapt==1.15.0 yarl==1.9.2

Password: 07-26 15:36 EasyAuthServer ERROR detected new EasyAuth server, created admin user with password: ropdqzfz

singlautsav avatar Jul 26 '23 10:07 singlautsav

Hi @singlautsav - Are you able to reproduce the steps in any particular order?

Using the above dependencies, I was not able to reproduce the issue, so I suspect there was an issue with your browser setting the token cookie after login.

codemation avatar Sep 27 '23 18:09 codemation

I run into this issue when:

  • log in with admin account and set up google auth
  • log out and sign in using google account
  • log out and try signing in as admin

After reading your comment, I deleted cookies and was able to sign in as admin

liamcryan avatar Dec 11 '23 23:12 liamcryan