PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. ahiraoka
  2. PLCnext Technology & PLCnext Controls
  3. Thursday, 30 April 2020

Hello,

 

Based on the manual (I attached the screenshot)  I could pass auth token and get the code. However, I couldn't pass authentication of the access token.

Could you tell me the way to  pass through?

myenv: PLCnext 2152, FW: 2020.0

 

Step1.

https://192.168.1.10/_pxc_api/v1.2/auth/auth-token
{"scope":"variables"}

=>I got the code : 5f6f6516617a6ad7

 

Step 2:

https://192.168.10.1/_pxc_api/v1.2/auth/access-token

{"code":"5f6f6516617a6ad7","grant_type":"authorization_code","username":"admin","password":"*******"}

=>Could not get any response.(because of time out)

 

I think the written manual is wrong. Please check the red circle of the attached screenshot.

 

Best regards,

Atsushi

Attachments (1)
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

UPDATE:

The typos in the documentation have now been fixed (thanks Gundula!).

=====================

Hello,

Thanks for the tips about the documentation - I will ask for that to be updated.

The JSON looks OK to me.

One problem might be the IP address in the second command - it is different to the IP address in the first command.

~ Martin.

 

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

Frank PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Atsushi,

I've made some weeks ago some tests with a small Python script and just tested them again with FW 2020.3.

It should work as follows:

Post:
https://192.168.178.150/_pxc_api/v1.2/auth/auth-token
{"scope": "variables"}

--> {"code":"a3bc88f6522ef0c0","expires_in":600}

Post:
https://192.168.178.150/_pxc_api/v1.2/auth/access-token
{"code": "a3bc88f6522ef0c0", "grant_type": "authorization_code", "username": "admin", "password": "12345678"}
--> {"state":"a3bc88f6522ef0c0","token_type":"Bearer","access_token":"4435fc3632d2116e","roles":[]}

Keep the HMI option (default) "Enforcement of User Levels" activated, otherwise you'll get a misleading result, that your password is wrong.
Which might be correct, but the authentication is disabled anyway ?.

My Python script is not ready to publish yet, but if you like I can give it to you by mail or just my postman library...

Frank


Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support

ahiraoka Accepted Answer Pending Moderation
0
Votes
Undo

Hello Martin-san, Frank-san,

 

Thank you for the support. Now I passed the 2nd step and got the values.

Please close the issue.

 

Best regards,

Atsushi

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.