What should the redirect URI be for my deployed python application?

Alasdair Kite 20 Reputation points
2023-07-04T14:26:58.4433333+00:00

I have deployed my web application to Azure and I am able to access the site using https://testoutlookapp.azurewebsites.net/login

When I click sign in I am given the error: invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application.

I am using the redirect uri set up on the Azure app registration as: http://localhost:5000/getAToken

My config file looks like this:

b2c_tenant = ''# Application (client) ID of app

registrationCLIENT_ID = 'd9079521-7634-4a43-af74-230589f9b3c6'

CLIENT_SECRET = '<I removed this>'

AUTHORITY='https://login.microsoftonline.com/common'

REDIRECT_PATH = "/.auth/login/aad"

ENDPOINT = 'https://graph.microsoft.com/v1.0/me/mailFolders'

SCOPE = ["Mail.ReadBasic", "Mail.Send", "User.Read"]

What should I of used?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. Akshay-MSFT 17,956 Reputation points Microsoft Employee Moderator
    2023-07-12T09:49:28.03+00:00

    @Alasdair Kite ,

    Thanks for your time and patience, from above description I am able understand that you are trying to deploy python application integrated with MSAL. You were able to signin to the application but not getting redirected to defined path "/getAToken".

    Please correct me if this is not the case by responding in the comments section.

    I was able to test this with ***tutorial *and following are my findings:

    • The application was called @ [http://localhost:8000].
    • Once I hit sign in it did redirect me to /getAToken
    • User's image
    • Then it took me consent page with common endpoint as I enabled my application for all account types:

    User's image

    On reviewing your configuration above I have following suggestions:

    • Redirect path must be same in the application code and application registration.

    In app.py, or app_config or app_config_B2C you must configure redirect path as below:

    User's image

    Similarly the redirect URL in the application registration must be same as in the application code:

    User's image

    Please do let me know if you have any further queries.

    Thanks,

    Akshay Kaushik

    Please "Accept the answer" (Yes), and share your feedback if the suggestion answers you’re your query. This will help us and others in the community as well.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.