Base solution for your next web application
Open Closed

Swagger: "Current user did not login to the application!" #3953


User avatar
0
zokho created

Hi All, Perhaps a simple inquiry: I have got a service guarded with permission attribute. How would I be able to call that service via Swagger? At the moment I am getting "Current user did not login to the application!" error which is right. But wonder if there is a way of bypassing the Authentication somehow from Swagger?

Regards,


1 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    You need to add security definitions and requirements, or authentication helpers.

    Add swagger security definitions and requirements: module-zero-core-template/pull/108

    • The 'proper' way.

    • If you have a way of getting accessToken, e.g. login with Postman.

    • If you are running IdentityServer, you can configure oauth2 login. Add swagger authentication helpers: module-zero-core-template/pull/87

    • The 'helper' way.

    • If you are running Swagger on the same site as your MVC application - supports csrfToken.

    • If you want an in-browser solution to login and manage the accessToken in the site cookie.

    • If you want to support multiple behaviors - also supports accessToken from Postman, etc. You can adopt either (or both). This may come in future releases.