You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by Daniel Quiroga <da...@gmail.com> on 2021/11/25 16:19:00 UTC

Error assigning connection to user via API

Hello!

Was doubting if this was the correct mailing list.

I am sending the connection ID and the username as parameters just as
suggested in this stackoverflow answer:

https://stackoverflow.com/questions/60651115/how-can-i-connect-user-with-a-connection-by-using-guacamole-rest-api

but, i keep getting this error:
The relevant code is on this paste:

https://pastebin.com/J5cLVcDH

¿does the rule against putting code into mailing lists still exist?

Thanks so much for your help in advance.

"{"message":"Unexpected internal
error","translatableMessage":{"key":"APP.TEXT_UNTRANSLATED","variables":{"MESSAGE":"Unexpected
internal error"}},"statusCode":null,"expected":null,"type":"INTERNAL_ERROR"}
◀"

Re: Error assigning connection to user via API

Posted by Daniel Quiroga <da...@gmail.com>.
Hello Nick!! Thanks for your answer!!

Yes, the code is failing when i try to assign the connection, the token and
token activation happens with no issue.

I will try right now.

Thanks for your help :)

D

On Thu, Nov 25, 2021 at 10:27 PM Nick Couchman <vn...@apache.org> wrote:

> On Thu, Nov 25, 2021 at 11:19 AM Daniel Quiroga <
> daniel.quiroga9004@gmail.com> wrote:
>
> > Hello!
> >
> > Was doubting if this was the correct mailing list.
> >
> >
> Possibly more appropriate for the user mailing list, but not a big deal,
> this is fine.
>
>
> > I am sending the connection ID and the username as parameters just as
> > suggested in this stackoverflow answer:
> >
> >
> >
> https://stackoverflow.com/questions/60651115/how-can-i-connect-user-with-a-connection-by-using-guacamole-rest-api
> >
> > but, i keep getting this error:
> > The relevant code is on this paste:
> >
> > https://pastebin.com/J5cLVcDH
> >
> >
> One question and one comment:
> * You don't indicate where the code is failing? I see three different
> methods in what I presume is PHP code (best guess without any context), but
> you don't indicate if the failure occurs while obtaining a token, while
> assigning the connection, or somewhere else?
> * The following block jumps out at me as possibly incorrect:
>
>
>    1. $response = $assignation->patch($apipath, [
>    2.
>    3. "op" => "add",
>    4. "path" => $connpath,
>    5. "value" => "READ"
>    6.
>    7.
>    8. ]
>
>
> I'm not familiar with the GuzzleHttp framework, but it would appear that
> you're feeding this patch method an array of options rather than an object.
> It seems possible that you'd instead want to do something like this:
>
>
>    1. $response = $assignation->patch($apipath, {
>    2.
>    3. "op" => "add",
>    4. "path" => $connpath,
>    5. "value" => "READ"
>    6.
>    7.
>    8. }
>
>
> with the curly braces instead of the square braces. The square braces
> usually indicate an array, the curly braces an object.
>
> I could be way off on that, but at a quick glance it's what jumped out.
>
> ¿does the rule against putting code into mailing lists still exist?
> >
> >
> I'm not sure there is, or ever was, any "rule" against it, but code
> formatting within e-mail clients and list archives can be painful, so it's
> probably still discouraged.
>
> -Nick"
>

Re: Error assigning connection to user via API

Posted by Nick Couchman <vn...@apache.org>.
On Thu, Nov 25, 2021 at 11:19 AM Daniel Quiroga <
daniel.quiroga9004@gmail.com> wrote:

> Hello!
>
> Was doubting if this was the correct mailing list.
>
>
Possibly more appropriate for the user mailing list, but not a big deal,
this is fine.


> I am sending the connection ID and the username as parameters just as
> suggested in this stackoverflow answer:
>
>
> https://stackoverflow.com/questions/60651115/how-can-i-connect-user-with-a-connection-by-using-guacamole-rest-api
>
> but, i keep getting this error:
> The relevant code is on this paste:
>
> https://pastebin.com/J5cLVcDH
>
>
One question and one comment:
* You don't indicate where the code is failing? I see three different
methods in what I presume is PHP code (best guess without any context), but
you don't indicate if the failure occurs while obtaining a token, while
assigning the connection, or somewhere else?
* The following block jumps out at me as possibly incorrect:


   1. $response = $assignation->patch($apipath, [
   2.
   3. "op" => "add",
   4. "path" => $connpath,
   5. "value" => "READ"
   6.
   7.
   8. ]


I'm not familiar with the GuzzleHttp framework, but it would appear that
you're feeding this patch method an array of options rather than an object.
It seems possible that you'd instead want to do something like this:


   1. $response = $assignation->patch($apipath, {
   2.
   3. "op" => "add",
   4. "path" => $connpath,
   5. "value" => "READ"
   6.
   7.
   8. }


with the curly braces instead of the square braces. The square braces
usually indicate an array, the curly braces an object.

I could be way off on that, but at a quick glance it's what jumped out.

¿does the rule against putting code into mailing lists still exist?
>
>
I'm not sure there is, or ever was, any "rule" against it, but code
formatting within e-mail clients and list archives can be painful, so it's
probably still discouraged.

-Nick"