Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
8 years ago
Solved

How to solve 401 (unauthorized) in playback?

When I play back the recorded script, I receive multiple 401 (unauthorized) codes, what is the best approach to solve this?   Thanks a lot.   Regards, Mathijs
  • AlexKaras's avatar
    8 years ago

    Hi Mathijs,

     

    To my understanding, the general approach is to identify what authorization info is expected in the failed request, where this info is obtained and why it was not applied to the given request.

    From the screenshot you provided, it can be seen that the recorded header of the highlighted request (#46) contains sessionid and authorization fields that with a high chance contain the required authorization info.

    Both these fields contain the same values in recorded and replayed requests and I think that the initial session had expired by the time recorded traffic was replayed and this caused authorization failure.

    The value of the authorization field after the 'bearer' token, with a high chance is Base64-encoded user name and password used to authorize in your application. (You may quickly check this via the Tools|TextWizard... window from Fiddler.)

    I think that you should trace up recorded requests until you find the one that provided new value of the session id in response to the supplied login credentials. After you will find this request (actually - response to the request with login credentials) you may try to figure-out if this situation had to be processed by LoadComplete automatically via its data correlation and data correlation rules mechanisms (https://support.smartbear.com/viewarticle/78604/, https://support.smartbear.com/viewarticle/90781/). You may contact Support if you think that the situation had to be processed automatically by LoadComplete. Otherwise, you will have to parameterize the requests by extracting the new session id (and, maybe, bearer's info for the authorization field) and providing it for all subsequent requests where it is needed (https://support.smartbear.com/viewarticle/78740/).

     

    Hope, the above will help...

     

    P.S. I am sure that you already went through the https://support.smartbear.com/viewarticle/78954/#AuthenticationErrors help article.