Open plaf2000 opened 3 weeks ago
Hi @plaf2000 is an open source project, feel free to open a PR with the proposed fixes. Please dont forget to add some test too
Hi @mattiagiupponi and thank you for your answer.
I will do that, but first I would like to know, if possible, the origin of the attribute 'unique_name'
: does that come from older versions of the API?
Thank you in advance
@mattiagiupponi Some other questions regarding testing. I see that at the moment the only social account tested is Google. Therefore:
- Would I need to write tests for Azure account from scratch?
If are not there, it would be nice
- If not (to the 2. question), should I simulate some fake API responses in the tests (e.g. how they do on django-allauth for the microsoft provider)?
Yes i guess mocking the responses is the best approach now
Expected Behavior
Successfully sign up with Microsoft Azure.
Actual Behavior
Getting the following error:
Steps to Reproduce the Problem
Specifications
Where the Problem Lies
The
'unique_name'
key specified by theUID_FIELD
Azure's provider settings variable (SOCIALACCOUNT_PROVIDERS_DEFS['azure']['UID_FIELD']
) is not in the response body from https://graph.microsoft.com/v1.0/me. The attribute that should be considered is'id'
instead: https://learn.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http.Proposed fix(es)
In order to fix the issue, it is enough to change the
UID_FIELD
to'id'
. This can therefore also be easly done by a settings override, but, probably, this should be the default field defined insettings.py
. To keep the backward compatibility with older API versions using the'unique_name'
field (is that so?), the following change could be taken into account as well:In that case it wouldn't be necessary to change the
UID_FIELD
value.