Questions tagged [http-token-authentication]

146 questions
1
vote
1 answer

How to create a new token with custom created datetime in Django Rest Framework?

I am using Token Authentication in my Django Rest Framework project. I have noticed that while creating a token, if I specify the created datetime field in the create method, than the token is not created with that value, for example: new_token =…
1
vote
1 answer

Django REST framework TokenAuthentication returns anonymous user

How do I properly implement DRF TokenAuthentication without the request object returning an anonymous user when I try to log in? according to the docs, when authenticated, the TokenAuthentication object provides the request.user which is the Django…
1
vote
1 answer

"Authentication credentials were not provided." Thunder client Django Rest

I am trying to restrict dashboard access only, which can be viewed only when the token is passed into the header but... if request.method == "POST": user_name = request.POST['user_name'] name = request.POST['first_name'] …
Atif Shafi
  • 954
  • 1
  • 11
  • 26
1
vote
1 answer

Symfony Login Issue Using ReactJS

I have an issue with my web application and I don't know how can I fix it. The first application is working good using default templates from Symfony. Now we need to move it on reactjs, we already have the react application working, but I have an…
Jianov
  • 41
  • 2
  • 12
1
vote
1 answer

How do you implement CSRF tokens in django rest framework?

I have noticed that when using django and you make a post request, using a form for example, django asks you to add the csrf token, but when I was fetching data from an api created with django rest framework with react I realized that when I didn't…
1
vote
0 answers

Flask HTTP Token Auth how to fetch objects owned by signed in user

I am building a Flask API, and I have set up the login with flask_httpauth's HTTPBasicAuth and HTTPTokenAuth. That is to say, I first send in the username and password, after which the API would return a token to me, and I would send that token in…
Samson
  • 1,336
  • 2
  • 13
  • 28
1
vote
1 answer

DRF Token Authentication - not able to retrieve Token on Postman

I'm trying to retrieve a token for the user using the following request through Postman. http://127.0.0.1:8000/api-token-auth/ JSON Body - { "username": "user1", "password": "testpass" } The following is the error response - { "detail":…
1
vote
1 answer

Returning the current user id along with the token when login using Token Authentication in django rest framework

I am using JWT token for login authentication. When the user logs in, it returns a token. how can i get the user id of the logged in user along with the token? I have tried it by using request.user. it it return AnonymousUser. class…
1
vote
0 answers

How to retrieve authentication token from initial HTTP Authentication Request in Swift for IOS App Development?

Currently, I have a Django-backend site with rest-framework-auth setup and functioning as far as the default web portal. I see many tutorials on how to remain authenticated with token authentication, but nothing that shows how to perform the initial…
nickid0419
  • 11
  • 2
1
vote
3 answers

Executing function before every controller request

I'm calling cloud APIs using token authentication with php-openstack-sdk. $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', 'user' => [ 'id' => '{userId}', 'password' =>…
chopz
  • 381
  • 1
  • 5
  • 21
1
vote
1 answer

Angular token based authentication, get and store the user profile, best practice

I started some months ago to build my first token-based authentication for an Angular project and now I need to upgrade it. Until now my /login endpoint returned just a token which is stored in the local storage. The user is logged in when the token…
NicuVlad
  • 2,491
  • 3
  • 28
  • 47
1
vote
1 answer

rest_framework.authtoken refresh on change password

I have successfully(hopefully) managed to implement a change_password action. However, after I change the password, the client automatically logsout. (token is probably not valid anymore) I would like the API Client to remain logged in after a…
1
vote
1 answer

Tests for signing in User using token and SimpleTokenAuthentication failing because SimpleTokenAuthentication not signing in user

Rails 5.2 gem: SimpleTokenAuthentication I have the following controller: class RegistrationsController < ApplicationController acts_as_token_authentication_handler_for User, only: [:start] def start binding.pry if…
chell
  • 7,646
  • 16
  • 74
  • 140
1
vote
0 answers

Best way to store token information in Angular JS

I am pretty confused with storing token information. Currently I am storing token information in Localstorage but the information remain even after closing the tab. Only during logout I am able to clear the token information from localstorage. But I…
1
vote
1 answer

Devise token auth not returning the Set-Cookie header on different domain

I have a rails 4 backend using DeviseTokenAuth and an AngularJS frontend using ngTokenAuth. When frontend and backend are deployed on the same domain the authentication works perfectly. When testing on localhost, with both the backend and the…