twilio / authy-php Goto Github PK
View Code? Open in Web Editor NEWA PHP client for Authy
A PHP client for Authy
On Twilio, Default locale is Identified on basis of Country code, But on Authy its documented as "en" (English)
There is no way to overide default locale. For Ex, I want to set language as "English" default was "Hindi", as per Twilio, i need to pass locale = 'en'
in request params , but in
Authy->phoneVerificationStart
there is no way to pass that param, i need to manually edit this function to add this param, to got it working.
Please add Twilio supported Params,
https://www.twilio.com/docs/verify/api/verification#request-a-verification-code
Our tests have syntax that breaks in version 6+ and version 5 is unsupported as of this month.
Our Travis build seems to expect version 5.x, but there's nothing that enforces that when you run it locally. If there's a way to specify the phpunit version, let's do that!
For anyone using spring boot 2.0.5, I was getting the following error during runtime
java.lang.NoSuchMethodError: org.json.JSONObject
to resolve I needed to exclude the following com.vaadin.external.google from spring-boot-starter-test:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
As that package had its own org.json dependency. Hope this saves someone some time
Most potential clients on earth need this.
Happy to help.
see commit a3ebfeb
Our main app uses Guzzle 6, which afaik is the "current" version. Are there any plans to update this package to use Guzzle 6?
Hi Guys,
I started using Authy for our project and I think that you made nice stuff but there is one issue with your library. I want to use one touch verification feature and had to extend your API class to handle this. Is there possible to merge pull request regarding one touch verification in the next release? Will be nice ;)
Best regards :)
Bryan Kennedy:
You might mention that simply placing the lib in your path is an installation option too
Link https://github.com/twilio/authy-php/blob/master/LICENSE from README is not available.
https://github.com/twilio/authy-php/blob/master/composer.json#L7 is set to MIT
Currently due to the implementation of the AuthyResponse class (protected internal variables), there is no way to access the response body or status code directly without rewriting (extending classes) of the library yourself.
This creates an issue with error handling. As stated here https://www.twilio.com/docs/verify/return-and-error-codes there are multiple status codes as well as custom error codes (which are part of the response's body).
It would be beneficial to add a body()
and a statusCode()
function (or similar) to the said class.
public function body()
{
return $this->body;
}
public function statusCode()
{
return $this->raw_response->getStatusCode();
}
It appears that there is a bodyvar
method. However, the status code is not available and bodyvar
is restricting the usage of custom exception handling based on the body contents, you need to retrieve every variable independently.
Could you please do the world a favor and update the readme to correspond to the code, so we don't waste our time implmenting a workflow that's no longer valid...
So using the method verifyToken
is giving me some problems. When I analyze the response I get this:
object(Authy\AuthyResponse)#582 (3) {
["raw_response":protected]=>
array(6) {
["meta"]=>
NULL
["body"]=>
NULL
["error"]=>
bool(true)
["error_msg"]=>
string(359) "Stream open failed for '/protected/json/verify/4095167/6317476?api_key=my_key&force=true'; req_time: 4.792213439941406E-5; opts: {"http":{"timeout":240,"method":"GET","content":null,"user_agent":"authy-php v1.3.0","header":["Content-Type: application\/x-www-form-urlencoded","Connection: close"],"ignore_errors":1,"max_redirects":0}}"
["status"]=>
int(0)
["headers"]=>
array(0) {
}
}
["body":protected]=>
NULL
["errors":protected]=>
object(stdClass)#589 (0) {
}
}
But when I do the GET
call manually with postman:
it works perfectly
{
"message": "Token is valid.",
"token": "is valid",
"success": "true"
}
Hi Authors
i recently installed this library via composer, i am unable to see the updated version that is on git hub for e.g whole phone verification
methods are missing.
your urgent action required..
Somehow the qrCode method was merged directly into a 3.x release branch, and is missing from the 4.x release due to it not being available in master.
The PR in question: #61
The Authy_autoloader function displays a message if it's unable to find a class. This really isn't the best behavior, as it's not necessarily the only autoloader present.
The phone verification API supports a code length modifier, but this library does not.
The phoneVerificationStart method does not allow a parameter for setting a custom message. Please add this feature as it is supported in the public API.
Hey,
I just added authy to my composer.json in my new Laravel framework based project.
I did composer update (as I'd already installed Laravel completely before and just needed to add the Authy PHP SDK) and it downloaded Authy into my project ready to start using.
Trouble is, when I start using the API I get an error:
Class 'Resty' not found
Which points to the Authy code.
How can I fix this?
Hi,
I need help with my code, I can't create an user; always I have the error_code 60030 and I dont find the error on the code.
If someone finds it, I would appreciate it too much. It's for a college project for my grades.
Thanks.
`<?php
$tituloPagina = "Activacion 2FA";
session_start();
include_once "registro.php";
include_once "conexion.php";
require "vendor/autoload.php"; //accedemos a las librerias del composer.json
$apiKey = "WeuGMlbzYPfa9uz0ZZ50BZd16H9nDsiv";
$apiUrl= "https://api.authy.com/protected/json/users/new?api_key=WeuGMlbzYPfa9uz0ZZ50BZd16H9nDsiv";
?>
The last official release was version 3.0 in January, but since then there have been a number of potentially significant updates. Most of them have bumped the version, which in retrospect may not have been necessary.
I currently have my project pulling directly from dev-master but that's a fairly poor practice and makes me slightly nervous as it means my project will automatically receive the newer code, even if there are BC issues.
I'm not sure whether you want to bump the version back down to 3.0.1 and do a release or even bump it forward to 3.1 (#55 could represent breaking changes for extending code as assumptions about the base_uri
may now be invalidated in order to have made OneTouch work).
Either way, some official release would be ideal 👍
Hi, can i use the v6 of Guzzle http with authy php ?
Thanks for reply
Hello there,
Can you please upgrade the guzzle to latest version ? Mostly other packages require guzzle version to 6.0.0 or above but authy require 5.3.1 or lower.
Thank you.
It would be nice to release a version of Authy-PHP using Guzzle 6.0 instead of Guzzle 5.0. Actually I can't use this library in the project where I'm working because there is a dependencies conflict.
Composer tries to install a very old version of Authy-PHP because it uses Resty instead of Guzzle, but it lacks a lot of features, so that is not a solution for me.
If "semver" is used for Authy-PHP versioning, then it should be easy to port the current version to Guzzle 6.0 without having to worry about breaking backwards compatibility.
Trying to auth with PHP library as per example without success
Auth attempts return stream error with url http://verify/{tokencode}/token{key}?force=true
it looks like the api url isnt loading correctly
In the code it is stated as
$resp = $this->rest->get("verify/{$token}/{$authy_id}", array(
'query' => $params
));
It doesnt appear to be loading the $api_url which is listed in AuthyApi.php as https://api.authy.com
If I try and manually run this I get notification that this is the wrong url being api.authy.com/verify is incorrect.
I have checked the python library and it uses api.authy.com/protected/json/verify can you advise what the correct url is?
If I attempt to use this url I get "error_code":"60001","message":"Invalid API key","errors":{"message":"Invalid API key"},"success":false
Since the merge of 12 december 2017 the $opts parameters is not merged anymore with $params in the verifyToken() method. Options like 'custom actions for sms' won't work anymore and the token becomes invalid.
Hi!
I am trying to require Authy in my WordPress instalation, in my functions.php file but I am not able to create a new instance of Authy. The server responds with a error 500. Somebody knows if I have to do something else? Maybe I need to call to another dependency?
thanks
Trying to upgrade from v2.2 to v3.0
Able to receive a token (int in v3.0, was string in v2.2) via SMS, but when verifying given token, API returns "token invalid"...
Is there a changelog somewhere I can read through to try to find (breaking) changes ?
Have already gone through the docs at https://www.twilio.com/docs/authy ...
Laravel 8 just got released and ships with Guzzle version 7.x out of the box. For now, the package can't be used in a new Laravel 8 project as the current stable release (3.0.5) requires Guzzle v6.0.x and the RC (3.1.0) requires v6.5.x.
Installing it produces the error below:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for guzzlehttp/guzzle (locked at 7.0.1, required as ^7.0.1) -> satisfiable by guzzlehttp/guzzle[7.0.1].
- authy/php 3.0.4 requires guzzlehttp/guzzle ~6.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- authy/php 3.0.5 requires guzzlehttp/guzzle ~6.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- authy/php 3.1.0-rc1 requires guzzlehttp/guzzle ~6.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- authy/php v3.0 requires guzzlehttp/guzzle ~6.0 -> satisfiable by guzzlehttp/guzzle[6.5.x-dev].
- Conclusion: don't install guzzlehttp/guzzle 6.5.x-dev
- Installation request for authy/php ^3.0 -> satisfiable by authy/php[3.0.4, 3.0.5, 3.1.0-rc1, v3.0]
Hi,
After I create a user using the API, e.g.:
$user = $authy_api->registerUser('email', 'xxx-xxx-xxxx', '1');
How could I get the 'authy-id' from the return $user object?
The command print_r($user) shows that it is a 'protected' field so I guess there is a function like 'getID' or something to retrieve the 'authy-id'?
Authy\AuthyUser Object
(
[raw_response:protected] => GuzzleHttp\Psr7\Response Object
(
+-- 78 lines-------------------------------------------------------
)
[body:protected] => stdClass Object
(
[id] => 15xxxxxx0
)
[errors:protected] => stdClass Object
(
)
)
Please advise. Thanks. Best regards,
Hi,
is this library dead?
I'm actually using it and it would be bad if it won't be actively supported...
I'm using laravel 9 I need support for php 8.1
the version 2.5 README and composer.json both state 5.3.0 or greater.
however there are short array declarations []
in authy and the version of guzzle it depends on (and still further dependencies PSR, promises), there are callable
type hints, static
anonymous functions, anonymous functions with closure over $this
, use of curl_reset
in there, and probably other things i have not found yet as i revise the code to work with PHP 5.3.10.
there does not appear to be documentation anywhere noting which specific version of authy to use for PHP prior to 5.4 so now i am stuck trial-and-erroring my way backward through releases.
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
Is there any workaround?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.