Azure-Samples / ms-identity-python-webapp

A Python web application calling Microsoft graph that is secured using the Microsoft identity platform
MIT License
293 stars 138 forks source link

Not authenticating #132

Closed baha00 closed 6 months ago

baha00 commented 7 months ago

Copied exact same, set application granted premissions but still getting

Login Failure invalid_request AADB2C90117: The scope 'User.Read' provided in the request is not supported. Correlation ID: a885fec3-921f-48b5-b163-e9c47aacebf0

by default there is SCOPE = ["User.ReadBasic.All"] but not working either way

rayluo commented 7 months ago

Try setting SCOPE=[] for now. You shall be able to login.

Setup SCOPE=["the_scope_for_your_web_api"] later after/if you setup your own web api in your tenant.

baha00 commented 7 months ago

OK, I added Web API, another app granted permissions, its logging in now. but, when calling /localhost:5000/call_downstream_api

{ "error": { "code": "InvalidAuthenticationToken", "innerError": { "client-request-id": "0ea8b19f-0fb6-4d82-99aa-dd3bc2ebed8d", "date": "2024-02-21T23:34:32", "request-id": "0ea8b19f-0fb6-4d82-99aa-dd3bc2ebed8d" }, "message": "Access token validation failure. Invalid audience." } }

Basiclly what I am trying to acheive is to return back custom property instead Welcome {{ user.get("name") }} to be user.get{"custom claim"}} and aslo use other custom claims..

rayluo commented 7 months ago

Looks like the webapp sample successfully obtained a token for you, but your web api somehow rejected that token. You may want to double check the scopes that you used in your web app matches the scopes of your web api expects.

It would be inefficient to guess the error in this chat. Please examine the setup based on the docs mentioned in the README.

baha00 commented 7 months ago

Did it step by step 3 times always same...

rayluo commented 7 months ago

As it currently stands, we would not have step-by-step approach to reproduce the issue that you described.