Expand my Community achievements bar.

SOLVED

External Authentication failed via PHP script

Avatar

Level 3
I'm not a PHP wiz - in fact I am not a backend coder so I am
somewhat struggeling with the sample scripts - I still hope for a
CF sample...



I'm trying to run and log in to AFCS via the commandline
(Terminal). I'm not sure what I'm doing wrong - here what I am
passing:

php -f /Applications/MAMP/htdocs/afcs.php args --debug
--host=http://connectnow.acrobat.com,fcguru,my_login,my_pass



The username and password I pass are correct. However I get
this response:

Error: exception 'AFCSError' with message '<response
status="error">

<error code="AUTH_FAILED">

<msg>Authorization Failed</msg>

</error>

</response>

' in /Applications/MAMP/htdocs/afcs.php:86



Really struggeling with this. Even once I get this working
from the commandline I do not know how to call this from a script
instead. I use CF on the backend, not PHP.



Regards,



Stefan



1 Accepted Solution

Avatar

Correct answer by
Level 3
thank you, that's very helpful. It seems I can now connect
from the Terminal so that's a good start. I also did not see the
PHP external auth example - I must have been blind!

I'll see how far I get with this. What I'm trying to do is
spawn new rooms based on a template on the fly, and I have some
doubts I'll be able to figure that out myself.





View solution in original post

6 Replies

Avatar

Employee
In the command line you show:

php -f /Applications/MAMP/htdocs/afcs.php args --debug
--host=http://connectnow.acrobat.com,fcguru,my_login,my_pass



you have commas to separate the parameters. Is that how you
run the command ? there shouldn't be commas there but
spaces.

Avatar

Level 3
thanks, I get the same response (auth failed) when I run



php -f /Applications/MAMP/htdocs/afcs.php args --debug
--host=http://connectnow.acrobat.com fcguru my_login my_pass



Any tips?

Avatar

Level 3
Also could you provide an example of how to call the PHP
class and its methods from another PHP script please? My PHP skills
aren't up to the task and it would be good to see a login and
roomlist retrieval for example, I can then probably work out the
rest myself.



Thanks.

Avatar

Level 3
Is the PHP commandline I posted syntactically correct? I'd
really appreciate a simple sample that shows how to use the PHP
script, being invoked by another script.



Failing that, and during the absence of a Coldfusion script
sample, is there more documentation on the external authentication
API? What can we pass and how, what's returned etc. I can't find
this detailed anywhere.



thanks



Stefan

Avatar

Employee
I would say that your command is syntactically correct, but
semantically incorrect :)



Two problems:



- there is no "args" parameter in afcs.php

- when you use php -f file.php you have to append a -- after
the php file to tell the interpreter to stop parsing parameters
because they belong to the script



So, try this:



php -f /Applications/MAMP/htdocs/afcs.php -- --debug
--host=http://connectnow.acrobat.com fcguru my_login my_pass



or this:



php /Applications/MAMP/htdocs/afcs.php --debug
--host=http://connectnow.acrobat.com fcguru my_login my_pass



Also, there is an example of a php web application that uses
external authentication in the examples folder
(ExternalAuthentication/php). Just drop the php folder somewhere in
your webserver and try it out.



Avatar

Correct answer by
Level 3
thank you, that's very helpful. It seems I can now connect
from the Terminal so that's a good start. I also did not see the
PHP external auth example - I must have been blind!

I'll see how far I get with this. What I'm trying to do is
spawn new rooms based on a template on the fly, and I have some
doubts I'll be able to figure that out myself.