Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Swagger Ui - Wep Api problem #2490


User avatar
0
jonas452 created

Hi,

I've got the angular 2 project up and running. Now for testing i would like to use de web api side directly. When i use the authenticate method everything goes fine.

When i check the cookies i can see token being stored.

But when i run any kind of method i receive this response

What am i forgetting?

I also have tried loggin in with the angular client and then using the web api. The result is the same. The client itself works just fine.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Does your request headers contains "Authorization" header ? Can you share a screenshot for one of your requests ?

    Are you trying to call webapi from a tool like postman or anything else ? I couln't understand that part.

    Thanks.

  • User Avatar
    0
    jonas452 created

    I am directly testing on the swagger ui. And yes, no Authenticationheader is being send with my request. So that seems to be the problem.

    Let's say i want to test purely on swagger ui? how do i make sure the authenticationheader is being send? I also have tried using postman. Seems to be a great testing suite.

    Which method do i need to execute on the webapi to receive a cookie with a tenant id? I thought it was /api/services/app/Account/IsTenantAvailable. But postman isn't receiving a cookie for that.

    Basicly i need a small nudge in the right direction so i know how to test my api's directly. Thanks for any further info.

    jonas

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use postman easily. Please refer to this document <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Angular#token-based-authentication">https://aspnetzero.com/Documents/Develo ... entication</a>

  • User Avatar
    0
    jonas452 created

    Exactly what i needed. Thx!