locked
Swagger Authorize - Application with identifier 'undefined' RRS feed

  • Question

  • User-893002196 posted

    Hi All,

    I got error:

    AADSTS700016: Application with identifier 'undefined' was not found in the directory 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

    My code:

     c.SingleApiVersion("v1", "AMPortal");
                            c.IncludeXmlComments(string.Format(@"{0}\bin\AMPortal.xml",
                            System.AppDomain.CurrentDomain.BaseDirectory));
                            c.DescribeAllEnumsAsStrings();
                            c.OAuth2("oauth2")
                              .Description("OAuth2 Implicit Grant")
                              .Flow("implicit")
                              .AuthorizationUrl("https://login.microsoftonline.com/xxxxx-xxxx-xxxx-xxxx-xxxxxxx/oauth2/authorize")
                              .TokenUrl("https://login.microsoftonline.com/xxxxx-xxxx-xxxx-xxxx-xxxxxxx/oauth2/token")
                              .Scopes(scopes =>
                              {
                                  scopes.Add("https://xxx.onmicrosoft.com/AMPortal/Read", "Read access to protected resources");
                                  scopes.Add("https://xxx.onmicrosoft.com/AMPortal/Write", "Write access to protected resources");
                              });
    
                            c.OperationFilter<AssignOAuth2SecurityRequirements>();

    May I know where I am going wrong?

    Please advise.

    Monday, June 10, 2019 7:39 AM

Answers

  • User61956409 posted

    Hi micnie2020,

    micnie2020

    I got error:

    AADSTS700016: Application with identifier 'undefined' was not found in the directory 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

    Please check whether you provided correct clientId for c.EnableOAuth2Support method, like below.

    c.EnableOAuth2Support("your_clientId_here",
        null,
        null, 
        "Swagger UI",
        additionalQueryStringParams: additionalParams);

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 11, 2019 8:12 AM