0

I have a Flask-Admin app running with Flask-Security and use a token based authentication for API calls. Everything was working correctly. The following method is what returned the token.

def get_token(self): 
        url = 'http://nginx/login'
        headers = {'Content-Type':'application/json'}
        data = {'email':os.environ['SCRAPER_USERNAME'], 
               'password':os.environ['SCRAPER_PASSWORD']}
        response = requests.post(url, headers=headers, data=json.dumps(data))
        jsonresponse = json.loads(response.text)
        self.token = jsonresponse['response']['user']['authentication_token']

I have now added templates to the login and logout pages of Flask-Admin and changed the urls to /admin/login. So I changed the one line from url = 'http://nginx/login' to url = 'http://nginx/admin/login' I thought this was all that was necessary but unfortunately I am now experiencing issues. This method now returns a 400 error when trying to load nginx/admin/login.

Nginx is the server running in a docker container. So it appears creating custom templates has caused the issue. Would anyone know why and how to resolve it?

0 Answers0