# EsiPy Authentification fail - python

**URL:** <https://forums.eveonline.com/t/esipy-authentification-fail-python/341920>\
**Category:** Third Party Developers\
**Created:** [December 16, 2021, 8:19am UTC](https://forums.eveonline.com/t/esipy-authentification-fail-python/341920 "2021-12-16T08:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirailla\_sander](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/mirailla_sander/32/301064_2.png) [@mirailla\_sander](https://forums.eveonline.com/u/mirailla_sander)\
**Post date:** [December 16, 2021, 8:19am UTC](https://forums.eveonline.com/t/esipy-authentification-fail-python/341920/1 "2021-12-16T08:19:12Z")

</div>

Hi,

I try to use the EsiPy to authenticate a user and grab information from the API.  
I use flask as an application server when I tried to log one of my characters I receives the following error message :  
Login EVE Online SSO failed: HTTP Error 400: b’{“error”:“invalid\_grant”,“error\_description”:“Grant type authorization\_code is not supported.”}’

The error message comes when I try to obtain a token when I have obtained authorization code.

below the code extract :

@app.route(’/sso/callback’)  
def callback():  
“”" This is where the user comes after he logged in SSO “”"  
# get the code from the login process  
#redirect\_uri, scopes, token = extract\_state\_token(request.args.get(‘state’))  
code = request.args.get(‘code’)  
token = request.args.get(‘state’)  
# compare the state with the saved token for CSRF check  
sess\_token = session.pop(‘token’, None)  
if sess\_token is None or token is None or token != sess\_token:  
return ‘Login EVE Online SSO failed: Session Token Mismatch’, 403  
app.logger.info(code)  
# now we try to get tokens  
try:  
auth\_response = esisecurity.auth(code)  
except APIException as e:  
return ’ je suis là : Login EVE Online SSO failed: %s’ % e, 403

The error is coming in the last exception when I call :  
auth\_response = esisecurity.auth(code)

Thanks in advance for your help

Mirailla

---

<div class="post-metadata">

**Author:** ![Cor\_El\_Dahken](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/cor_el_dahken/32/463499_2.png) [@Cor\_El\_Dahken](https://forums.eveonline.com/u/Cor_El_Dahken)\
**Post date:** [December 20, 2021, 2:33pm UTC](https://forums.eveonline.com/t/esipy-authentification-fail-python/341920/2 "2021-12-20T14:33:32Z")

</div>

It is possible that if you are using EsiPy out of the box it may not be completely compatible with current SSO.  
There have been some changes recently, I do not use it all the time so am not completely up to date. But EsiPy has not been updated since August 2020 it looks.

Go through your code process and compare to [ESI Step by Step - SSO to Authenticated Calls - EVE: Developers](https://developers.eveonline.com/blog/article/sso-to-authenticated-calls) to make sure everything you are doing is up to spec.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [March 20, 2022, 2:34pm UTC](https://forums.eveonline.com/t/esipy-authentification-fail-python/341920/3 "2022-03-20T14:34:16Z")

</div>

Closed on March 20, 2022, 2:34pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
