Introduction
This series of posts intends to develop a flutter signup/login app working with API calls to Django backend. The idea is to...
For further actions, you may consider blocking this person and/or reporting abuse
i'm not getting whats wrong here
all my end points including
this localhost:8000/api-token-auth/
always return 404.
i can only acess localhost:8000/admin/
can you make available any sourcecode for comparisson?
check whether you have url for api in urls.py
This must be the issue
try using 127.0.0.1:8000 or sometimes u need to add your android emulator to allowed hosts. Add 10.0.2.2 in your allowed hosts of your django project
You'll get the following error is you try to open 127.0.0.1:8000/api/user
{
"detail": "Authentication credentials were not provided."
}
Solved it by adding the following line
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
...
),
}
I was having the same issue, thank you this solved my problem, but for the api-token-auth/ :
{
"detail": "Method \"GET\" not allowed."
},
I'm still getting
{
"detail": "Method \"GET\" not allowed."
}
Hi Amartya,
I am having difficulties to understand creating new user.
SOLVED:
So, I was thinking always to send users own token. But at the and need superuser's auth token for creating new user :))
below was my question:
When I request : POST, localhost:8000/api/user/ with username, password, I got {
"detail": "Authentication credentials were not provided."
}
So then do I need auth token first so. I tried also :
1- POST, localhost:8000/api-token-auth/ with newusername, newpasword and I got:
{
"non_field_errors": [
"Unable to log in with provided credentials."
]
}
At the end I can not create new user. So, for creating new user, how to on?
I am sorry for this stupid question but I am newbie and stacked here
Waiting for the next ones
Next post (#2) is out: dev.to/amartyadev/flutter-signup-l...
Great tutorial ! For the next steps and to go faster I use DjangoModel2Dart to transform my Django models to Dart classes to transform from the json of the REST API from Django or to json.
127.0.0.1:8000/api-token-auth/
{
"username": "foo",
"password": "password"
}
{"detail":"Method \"GET\" not allowed."}
Is "Method \"GET\" not allowed." expected? Or I screw up?
part 2-3?