stormpath-sdk-php
stormpath-sdk-php copied to clipboard
Authentication required error if * in password
Issue Type (Leave One)
Bug
Version affected
1.17.1
Summary
When a password contains a '*' (star) character the error 'Authentication required.' is returned. It appears like the SDK is not encoding the characters properly.
Steps to Reproduce
Set the password to anything with a star like '1234567*' and then try to login using the following.
$passwordGrant = new PasswordGrantRequest($email, '1234567*');
$auth = new PasswordGrantAuthenticator(StormpathApplication::getInstance()->application());
$authenticationResult = $auth->authenticate($passwordGrant);
Expected Results
Login should work.
Actual Results
The response is 'Authentication required.'
exception 'Stormpath\Resource\ResourceError' with message 'Authentication required.' in /home/www-gofer-server/gofer-server/src/vendor/stormpath/sdk/src/DataStore/DefaultDataStore.php:292
Stack trace:
#0 /vendor/stormpath/sdk/src/DataStore/DefaultDataStore.php(352): Stormpath\DataStore\DefaultDataStore->executeRequest('POST', 'https://api.sto...', '{"username":"...', Array)
#1 /vendor/stormpath/sdk/src/DataStore/DefaultDataStore.php(168): Stormpath\DataStore\DefaultDataStore->saveResource('https://api.sto...', Object(Stormpath\Oauth\PasswordGrantAuthenticationAttempt), 'GrantAuthentica...', Array)
#2 /vendor/stormpath/sdk/src/Oauth/PasswordGrantAuthenticator.php(47): Stormpath\DataStore\DefaultDataStore->create('https://api.sto...', Object(Stormpath\Oauth\PasswordGrantAuthenticationAttempt), 'GrantAuthentica...')
#3 Stormpath\Oauth\PasswordGrantAuthenticator->authenticate(Object(Stormpath\Oauth\PasswordGrantRequest))
More Info
Probably happens with other characters too - I've just only tested *
Fix has been created for this in https://github.com/stormpath/stormpath-sdk-php/pull/200. This will be merged for our next release.
Wow, that was fast. Thanks!
NP... Happy to help... You can see what I changed to make this work in the change log for the DefaultDataStore. We were using http_build_query which was urlencoding special characters