1. Vijay Kumar
  2. PowerServer
  3. Monday, 8 April 2024 05:52 AM UTC

Hi Team,

 

I enabled buil-in jwt authentication for powerserver application with database user list, I am able to get the access token, however i am unable to start application i mean beginsession is failing , i enabled the application object additional properties Dynamic session parameters, so i am using the Beginssion() statement to start the application,  But once i ran the application i am able to get the access token, after that the control is coming to Beginsession and failing , It is giving erorr like below .

 

 

 

 

 

 

 

 

Can any one suggest on this, it is very urgent.

 

PB Details...

 

 

Vijay Kumar Accepted Answer Pending Moderation
  1. Thursday, 18 April 2024 16:29 PM UTC
  2. PowerServer
  3. # 1

Hi Logon ,

 

Please be informed that issue has been resolved i missed two lines  as stated below ...

 

 Claims = new[]
                    {
                        new Claim(JwtClaimTypes.Name, u.GetValue<string>(0)),
                        new Claim(JwtClaimTypes.Scope, "serverapi"),  //this script is added because scope is enabled by default
                    }
After adding these two line items then my application is working perfect.

Thanks for your help & guidence.

Regards,
Vijay.
Comment
  1. Logan Liu @Appeon
  2. Friday, 19 April 2024 04:56 AM UTC
This is a good news!

  1. Helpful
There are no comments made yet.
Vijay Kumar Accepted Answer Pending Moderation
  1. Thursday, 18 April 2024 03:29 AM UTC
  2. PowerServer
  3. # 2

Hi Logon Liu,

Thanks for your feed As suggested i checked the log by changing the flag from warning to Trace ,debug ,information and Error none of the flag given log for me ,However i am attaching the sample project , please help to check and give your valuable feedback , much appreciated.

I am attaching along with db file too.

 

db : sap sql anywhere 17

PB : 2022 R3 Build : 3289

 

 

Regards,

 

vijay

 

 

Attachments (1)
Comment
  1. Logan Liu @Appeon
  2. Thursday, 18 April 2024 03:44 AM UTC
Please provide your C# solution.
  1. Helpful
  1. Logan Liu @Appeon
  2. Thursday, 18 April 2024 05:16 AM UTC
1) According to your PB project, you didn't send the password when getting the JWT token.

///ls_PostData = '{"Username":"' + ls_UserName + '", "Password":"' + ls_UserPass + '"}'

ls_PostData = '{"Username":"' + ls_UserName+ '"}'

2) Everything goes well if using the newly generated C# solution and passing in the correct username and password.

I can see the message comes from your MessageBox("hi","how r u").

You can delete your C# solution and try again.
  1. Helpful
There are no comments made yet.
Vijay Kumar Accepted Answer Pending Moderation
  1. Tuesday, 16 April 2024 16:53 PM UTC
  2. PowerServer
  3. # 3

Hi Logan,

 

I checked all logs but nothing is logged as such which is related to powerserver.

Comment
  1. Francisco Martinez @Appeon
  2. Tuesday, 16 April 2024 19:45 PM UTC
Did you check the Web APIs' logs? Try changing the logging severity so that more details are recorded, you can see how to do that here: https://docs.appeon.com/ps2022/Logging_with_the_settings_in_Logging.json.html



Regards - Francisco
  1. Helpful
  1. Logan Liu @Appeon
  2. Wednesday, 17 April 2024 07:04 AM UTC
Hi Vijay,

Please find Logging.json in your C# solution, and change the Microsoft log output level from "Warning" to "Information".

Reproduce the issue and check the log in the console or the PowerServer log file.

--

// Sets the Microsoft log output level

"Microsoft": "Information",

--

Regards, Logan
  1. Helpful
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 16 April 2024 08:47 AM UTC
  2. PowerServer
  3. # 4

Hi Vijay,

Please provide more logs of the PowerServer Web API as Mike suggested. 

Regards, Logan

Comment
  1. Vijay Kumar
  2. Tuesday, 16 April 2024 16:58 PM UTC
Hi Logan,



I followed same steps as mentioned in the above tutorial , Actually I am trying to authenticate jwt token using the user name and password using database user.I am getting access token successfully, but the when the control trying to execute the beginsession at that time i am getting the error which is privously i attached.like ---------------------------

Throwable

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

Session creation failed.

Cause: (HTTP status code: 403). (Web API: https://localhost:5000/api/ServerApi/CreateSession).

Learn more at: https://docs.appeon.com/ps/troubleshooting_guide/Session_creation_failed.html

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

OK

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

Could you please assist on this.



Regards,

Vijay.
  1. Helpful
  1. Logan Liu @Appeon
  2. Wednesday, 17 April 2024 01:31 AM UTC
Hi Vijay, is it possible for you to provide a small case that can reproduce this issue? It doesn't matter whether to use a database because this issue seems occurred after getting the token.
  1. Helpful
  1. Vijay Kumar
  2. Thursday, 18 April 2024 05:35 AM UTC
Hi Logan,



Thanks for your reply. The project which i attached here can reproduce this issue. Please help to check the same.
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Monday, 8 April 2024 13:27 PM UTC
  2. PowerServer
  3. # 5

did you look at your webserver log?

Comment
There are no comments made yet.
Alex Peters Accepted Answer Pending Moderation
  1. Monday, 8 April 2024 10:03 AM UTC
  2. PowerServer
  3. # 6

 

 

I am currently facing the same problem.
I authenticate myself, then I set the header and call BeginSession(). The Applications object is set to dynamic parameters. From my point of view, everything is fine. Nevertheless, I also get the message when I call BeginSession().

---------------------------
Throwable
---------------------------
Session creation failed.
Cause: Found (HTTP status code: 302). (Web API: http://localhost:5000/api/ServerApi/CreateSession).
Learn more at: https://docs.appeon.com/ps/troubleshooting_guide/Session_creation_failed.html
---------------------------
OK
---------------------------

I have implemented the JWT authentication as in the sample (https://github.com/Appeon/PowerServer-Authentication-Example) and also get the message when calling BeginSession().

However, if I use a GenApp and implement everything as described in the help (https://docs.appeon.com/ps2022r3/Using_JWT.html), then it works.


I am using PowerBuilder/Runtime 2022 R3 Buid 3305

Gretings

Alex

Attachments (1)
Comment
  1. Vijay Kumar
  2. Monday, 8 April 2024 11:22 AM UTC
Hi Alex,



Thanks for your reply , let me check and update you...
  1. Helpful
  1. Francisco Martinez @Appeon
  2. Monday, 8 April 2024 15:31 PM UTC
Hi Alex,



Your error is different. You're getting an HTTP 302, which indicates that the resource has been temporarily moved. I'm not sure what could be trying to redirect you. Are you running the Web APIs on HTTPS?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.