oidc-agent icon indicating copy to clipboard operation
oidc-agent copied to clipboard

Failed to parse JSON while obtaining mytoken

Open Nithe14 opened this issue 1 year ago • 3 comments

Attempting to obtain a mytoken results in an error. When running the following command:

oidc-token <profile_name> --mytoken="{\"capabilities\": [\"AT\"]}"

the browser opens with a mytoken creation approval page. After debugging, I noticed that the function assigned to the "Continue" button propably has an incorrect name: _approve() instead of approve(), which is why the button doesn't work initially. After manually changing the function name in the HTML source and accepting the token creation, oidc-agent returns the error:

Error: could not parse json

I'm not certain if the problem might be related to the mytoken server itself, as there are no logs for this error on the server.

The profile was originally created using the following command:

oidc-gen -m --prompt=cli --flow=device --mytoken-url=$MYTOKEN_URL --issuer=$ISSUER --redirect-uri=http://localhost:8080 --scope=openid --scope=profile --scope=offline_access --mytoken-profile="{\"capabilities\": [\"AT\", \"create_mytoken\", \"manage_mytokens\", \"tokeninfo\"]}" <profile_name>

Obtaining access_token works correctly.

As I understand the new mytoken should be created with capabilities no greater then the original mytoken stored in the profile.

Nithe14 avatar Jun 20 '24 08:06 Nithe14

Sorry for the delayed response, I was on vacation. I can confirm the problem and will look into it.

zachmann avatar Jul 08 '24 06:07 zachmann

I did some investigations, and indeed this seems to be caused by mytoken. I assume you use your own mytoken server. Can you test the version currently on the prerel branch?

zachmann avatar Jul 08 '24 15:07 zachmann

Yes, I host it myself. I've tested the prerel branch of the mytoken server, and it works perfectly fine. Thank you! I look forward to the main release.

Nithe14 avatar Jul 09 '24 05:07 Nithe14