Open Closed

Swagger authorization error #7051


User avatar
0
Repunjay_TASC created

Need help configuring swagger authorization. can't get past the following error.

error:invalid_request error_description:The specified 'redirect_uri' is not valid for this client application. error_uri:https://documentation.openiddict.com/errors/ID2043

for your refence i have attached swagger url and table screen shots


57 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please sahre the logs of authserver. Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    Repunjay_TASC created

    It has been sent. Thank you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The redirect URL in the request does not match the value in the database.

    https://localhost:44318/swagger/oauth2-redirect.html https://localhost:44343/swagger/oauth2-redirect.html

    Client validation failed because 'https://localhost:44343/swagger/oauth2-redirect.html' was not a valid redirect_uri for Files_App.

  • User Avatar
    0
    Repunjay_TASC created

    Can you please guid, where I miss configuration? Also please find above table screenshot "Redirecturi " and "Clienturi" column value is correct?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please update the correct URL in the database and then clear the cache(redis).

    change https://localhost:44318 to https://localhost:44343

  • User Avatar
    0
    Repunjay_TASC created

    Hi ,

    1. I have updated same port in DB now **redirect_uri ** error got resolved.

    However, While I am click on below "Authorize" button, I am getting below error, what could be the issue for this?

    error :-

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share the data in the database again.

    Thanks.

  • User Avatar
    0
    Repunjay_TASC created

    1.The above error was fixed because I used "Files_App" instead of "Files_Swagger" for the swagger application. however, modified the database "ClientId"  column values to "Files_Swagger".

    However, I'm still having issues.

    DBMigrator appsetting.json database

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to remove the client secret for the swagger application.

    Swagger is a public application. https://auth0.com/docs/get-started/applications/confidential-and-public-applications

    https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json#L38-L41

    https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs#L188-L198

  • User Avatar
    0
    Repunjay_TASC created

    Hi

    1. As per your suggestion i have removed ** client secret** for the **swagger ** application. able to authorizations.

    2. However, I want to login using angular application i have done below steps but facing **invalid_scope **error. error:invalid_scope error_description:The specified 'scope' is invalid.

    Database :-

    appsetting.json

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    error_description:The specified 'scope' is invalid.

    Please share the logs.txt and Permissions of your clients

  • User Avatar
    0
    Repunjay_TASC created

    It has been sent. Thank you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The authentication request was rejected because invalid scopes were specified: ["Files"].

    "client_id": "Files_App",

    Please check the scopes of Files_App

  • User Avatar
    0
    Repunjay_TASC created

    Can you pls guide me where i miss configuration or what are configuration need to cross check ?

    FilesAuthServerModule.cs

    Appsettings.json

    FilesHttpApiHostModule.cs

    Angular

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please check the OpenIddictDataSeedContributor file

    await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor {
                    Name = "Files", DisplayName = "Files API", Resources = { "Files" }
                });
    

    https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/OpenIddict/OpenIddictDataSeedContributor.cs#L59-L67

    You can also try to clear the cache(redis).

  • User Avatar
    0
    Repunjay_TASC created

    This code already present

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a simple project? liming.ma@volosoft.com

    I will check it locally.

  • User Avatar
    0
    Repunjay_TASC created

    It has been sent. Thank you

  • User Avatar
    0
    Repunjay_TASC created

    Is there an alternative option for sharing the project with you, as emails don't seem to be delivered?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can share project via https://wetransfer.com/

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. I will download and test it.

    btw, can you share some steps about your project?

  • User Avatar
    0
    Repunjay_TASC created

    This is a sample project. I'm currently conducting a proof of concept (POC) for a File Management module. However, I want to run and test the File Management module locally. To do this, I simply ran ABP Suite locally and added the File Management module. Then, I tried to run the project as per the guidelines provided by ABP.IO .

    I haven't configured any steps from my side this project.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    How can I get the The authentication request was rejected because invalid scopes were specified: ["Files"]. via your sample project?

  • User Avatar
    0
    Repunjay_TASC created

    You can login using angular application then you will get this error, However, i shared below two tables data via email.

    "OpenIddictApplications" "OpenIddictScopes"

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, I will give it a try. Thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09