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

401 Unauthorized on Frontend Part #80

Closed
ftelnov opened this issue Sep 7, 2021 · 4 comments
Closed

401 Unauthorized on Frontend Part #80

ftelnov opened this issue Sep 7, 2021 · 4 comments

Comments

@ftelnov
Copy link

ftelnov commented Sep 7, 2021

I've integrated backend part +- successfully - I have nothing on /admin/, getting 404, but have created first Admin user and logged in on the backend site properly.
The problem is that I'm typing the same password on frontend part and getting Unauthorized response despite the fact the credentials are correct. Here is logs I'm receiving on backend part:

INFO:     127.0.0.1:46580 - "OPTIONS /admin/site HTTP/1.1" 200 OK
INFO:     127.0.0.1:46580 - "GET /admin/site HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:46586 - "OPTIONS /admin/login HTTP/1.1" 200 OK
INFO:     127.0.0.1:46586 - "POST /admin/login HTTP/1.1" 401 Unauthorized

How to overcome that? Maybe I'm doing something wrong? Did I miss something?
The total process of my installation is like that:

  1. Mounted to existing project - I've added admin model and some models of my apps. Database integration succeed, as well as redis integration. And the creation of the initial user was succeed. I could even login through /admin/login page - but on /admin/ I see only 404 page.
  2. Restful-admin frontend part - I've installed it using yarn and it works good, could even communicate to backend.
@ftelnov ftelnov closed this as completed Sep 8, 2021
@ftelnov
Copy link
Author

ftelnov commented Sep 8, 2021

The thing is that you don't need frontend part. Everything is working out-of-the-box.
The problem was, as I expected, in__init__ file of my main package.
Remember - you should add imports of your resources and routers admin modules somewhere. Without that they won't be even included.
And, tbh, I think, that despite the fact this project is the one providing dashboard for fastapi, it is still VERY badly documented..

@DoubleDi
Copy link

Hi @ftelnov!
Having the same problem currently. What imports did you add? Can you please send an example?

@ftelnov
Copy link
Author

ftelnov commented Sep 14, 2021

Hi @ftelnov!
Having the same problem currently. What imports did you add? Can you please send an example?

For example, my main module named app. So in init file of that module I have to place 'from app.core.admin import resources, router'. And that is all. You can see such init file in examples of this project.

@DoubleDi
Copy link

Awesome! Thanks a lot!

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

No branches or pull requests

2 participants