Highlighted
Contributor.. Contributor..
Contributor..
321 views

No permission found for user - JWT Token related - Script Replay Error - Assistance Required

Dear Team,

Request your help to assist in solving the below problem.

Scenario1: When I am manually accessing UI, token is getting generated and it is valid and no role permission error.

Token From UI:

eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSJ9.eyJhdWQiOiJlZDlhMzkwMC05MmE2LTQxYTQtYjdlZC0zMzM0MjMxYjI2YTUiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wNWQ3NWMwNS1mYTFhLTQyZTctOWNmMS1lYjQxNmMzOTZmMmQvIiwiaWF0IjoxNTM4MTI1MjE3LCJuYmYiOjE1MzgxMjUyMTcsImV4cCI6MTUzODEyOTExNywiYWlvIjoiQVNRQTIvOElBQUFBcTF0SXpGSGl4eGUxZWN5bG00Y3BiVDlIK3NuSERHazU4aE93K2VlZDBIWT0iLCJhbXIiOlsicHdkIl0sImZhbWlseV9uYW1lIjoiSmFndGlhbmkiLCJnaXZlbl9uYW1lIjoiSmFudSIsImlwYWRkciI6IjE5NS44NS4yMDQuMTQxIiwibmFtZSI6IkphZ3RpYW5pLCBKYW51Iiwibm9uY2UiOiIwYzY3MWVmOC04N2UwLTQ2MWQtYjRjMC04MTI0NDk0ZDA5MTMiLCJvaWQiOiJiZTdlZWI1Zi0zMDdkLTRlNmYtYjg5OC0xMmUzMTQ5YTVmNmMiLCJvbnByZW1fc2lkIjoiUy0xLTUtMjEtMTU0NzE2MTY0Mi0xMjE0NDQwMzM5LTY4MjAwMzMzMC0yNjYxMTE0Iiwicm9sZXMiOlsiU2FsZXNBZ2VudCIsIkdTQyIsIlRyYWRlTWFuYWdlciJdLCJzdWIiOiJNYjluWHNHblpvaTVVMDJaSEFydXE2UXBaamNXOWdESnF1WmE2RmlWNDQ4IiwidGlkIjoiMDVkNzVjMDUtZmExYS00MmU3LTljZjEtZWI0MTZjMzk2ZjJkIiwidW5pcXVlX25hbWUiOiJqYW51LmphZ3RpYW5pQE1hZXJzay5jb20iLCJ1cG4iOiJqYW51LmphZ3RpYW5pQE1hZXJzay5jb20iLCJ1dGkiOiJlYWU2WHBaVjBrU3RKckVIYU9QckFBIiwidmVyIjoiMS4wIiwiTWFlcnNrSUQiOiJKSkExOTQifQ.dY2WKWoRscPPzZnGKU_vYv9pqzthooS0-BMFgzd0DXpcOxoLaN1QrKDoC7XIwUSSnmbQ-C9x81bwyDuZ1kj9tZBXBRMGHLf1tqU--Y4sMimboCcamkryvmAJn0OGurvdzcD-o8eYqtahIFPx49hJInM2lBVEMdhk4Odo8qhNSgKZXk93M-TIxb6OgeGjdB96XQf6WGEgSnlj_PoqkcH41bj-MBVYLj9fwxyl_9h2Nx301l0chVRNwTZmWUPGsGrOh-nv-9sS_aXbt-tuaKTeyCWdA0cvgM-iIsKyt_vWWZGCz6gJNdDmm6mMafN_AIV3clCcvijFJ22iV0Jz1DbYSQ

 

I passed this in jwt.ms - It shows role permission

-----------------------------------------

Scenarop 2: When I hit application through script it throws below error.

Replay Log Error:

CAT_Save_Submit.c(385): t=57773ms: 82-byte response body for "https://api-spt.staging.customerallocations.maersk.com/referencedata/v1/rolePermission" (RelFrameId=1, Internal ID=31)
CAT_Save_Submit.c(385): {"code":"400","reference":null,"message":"No permissions found for provided role"}
CAT_Save_Submit.c(385): Error -26631: HTTP Status-Code=400 (Bad Request) for "https://api-spt.staging.customerallocations.maersk.com/referencedata/v1/rolePermission" [MsgId: MERR-26631]
CAT_Save_Submit.c(385): web_url("rolePermission_3") highest severity level was "ERROR", 82 body bytes, 610 header bytes [MsgId: MMSG-26388]

 

Generated JWT token from script:

eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhS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8GRFcFprzNwDw39LfS3aiKvXGQCx1gkcH_0VrpWDemv1xXDBH4EA

 

Kindly advise how to handle this.

In vuser_init section I have used this code to generate Token:

vuser_init()
{
    web_set_max_html_param_len ("9999999");
    web_set_sockets_option("MAX_CONNECTIONS_PER_HOST","1");
    web_set_sockets_option("SSL_VERSION", "TLS1.2");
    web_set_sockets_option("IGNORE_PREMATURE_SHUTDOWN", "1");
    web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS","TRUE");
    
    
    //web_set_sockets_option("SSL_VERSION", "TLS");
    
    //web_set_sockets_option("SSL_VERSION", "1");
    
    web_reg_save_param("Authtoken","LB=\"access_token\":\"","RB=\"}","Search=ALL",LAST);


    web_submit_data("ABC",
                    "Action=https://login.microsoftonline.com/05d75c05-fa1a-42e7-9cf1-eb416c396f2d/oauth2/token",
                    "Method=POST",
                    "EncType=application/x-www-form-urlencoded",
                    "MODE=HTTP",
                    ITEMDATA,
                    "Name=client_id", "Value=ed9a3900-92a6-41a4-b7ed-3334231b26a5", ENDITEM,
                    "Name=client_secret", "Value=DZC9mukOUy0ebr6VuHcXhD4CEUXeCQwzmyzx17XXXCE=", ENDITEM,
                    "Name=grant_type", "Value=client_credentials", ENDITEM,
                    "Name=username", "Value=sonal.pathak@maersk.com", ENDITEM,
                    "Name=password", "Value=Jul@2018", ENDITEM,
                    "Name=scope", "Value=api", ENDITEM,
                    LAST);

    lr_param_sprintf("auth","AuthCode %s",lr_eval_string("{Authtoken}"));

    lr_message(lr_eval_string("{auth}"));

    lr_message(lr_eval_string("{InitialDateTime}"));
    initialTime=atoi(lr_eval_string("{InitialDateTime}"));
    
    lr_think_time(3);
    
    return 0;
}

0 Likes
1 Reply
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: No permission found for user - JWT Token related - Script Replay Error - Assistance Required

Hi @Janu Jagtiani,

Were you able to resolve it by now?

Did you print the value of Authtoken just before you use it in the relevant Action (not in the Init Action)?

Regards,
Shlomi

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.