Thanks for the extra info. The "Authentication Failed" error you are experiencing occurs when attempting to authenticate an administrator/moderator account (who has elevated permissions) and the client IP address that is sent in the SSO token is different than the user's IP who is trying to redeem the token.
To authenticate the user with the API, the IP address in the token needs to be the server's IP address (the server that is making the calls). You can manually set this using this call:
$liToken = $lithium->get_auth_token_value("89", "ismail", "[email protected]", $settings_array, $lithium->get_server_var("HTTP_USER_AGENT"), $lithium->get_server_var("HTTP_REFERER"), "EXTERNAL.IP.ADDRESS.HERE");
Please let me know how this works for you.
Thanks!
Brad