500 error on service authentication - TangentMicroServices/MicroSerivcesWiki GitHub Wiki

The service returns a 500 error when authenticating with my token:

500 : INTERNAL SERVER ERROR http://projectservice.staging.tangentmicroservices.com/api-explorer/api-docs/

Fix:

  1. ssh into the server and start up the service environment

  2. open a python shell

     python manage.py shell
    
  3. Run the authentication code

     from tokenauth.authbackends import *
     bke=TokenAuthBackend()
     bke.authenticate("<token>")
    

If you get the following error:

IntegrityError: duplicate key value violates unique constraint "auth_user_username_key"
DETAIL:  Key (username)=(bloggs) already exists.

Then login to the admin panel of that service, delete the user and try again

⚠️ **GitHub.com Fallback** ⚠️