mautic / mautic/api-library

BasicAuth with incorrect credentials returns Mautic\Auth\BasicAuth Object

Open
#189 6 comments 0 reactions 1 assignee View on GitHub

@Woeler is already working on this.

Since Apr 22, 2019.

Bug
Dominant language
PHP
Stars
205
Forks
129
PR merge metrics
No merged PRs in 30d

Description

This looks an awful lot like Mautic is returning a successful authentication when I test it with bad credentials. Here's my auth code:

	protected function authenticate($mautic_url, $mautic_username, $mautic_password) {
	    session_start();
	    
	    $settings = array(
	        'baseUrl'          => $mautic_url,       // Base URL of the Mautic instance
	        'userName'         => $mautic_username,
	        'password'         => $mautic_password,
	    );
	    
	    $initAuth = new ApiAuth();
	    return $initAuth->newAuth($settings, 'BasicAuth');
	}

I noticed that your example on the ReadMe has no reference to which URL to use when using basic auth, so I guessed from viewing the OAuth example that the settings key might be "baseUrl" like it is in the OAuth example.

If I put in a valid Mautic url and a bunk username/password ("asdf" and "asdf"), it returns this:

[19-Apr-2019 22:21:13 UTC] Auth returned: Mautic\Auth\BasicAuth Object
(
    [password:Mautic\Auth\BasicAuth:private] => asdf
    [userName:Mautic\Auth\BasicAuth:private] => asdf
    [_debug:protected] => 
    [_httpResponseHeaders:protected] => 
    [_httpResponseInfo:protected] => 
    [_curlTimeout:protected] => 
)

That does not look like the data structure that your documentation says will be returned in the event of incorrect credentials. Also, it looks the same as when I submit real credentials (the username and password show values, the rest do not).

Please advise as to what is going on and also if you could give me a working example of basic auth, that would be much appreciated, or better yet just update the BasicAuth part of the readme so that it works.

Best,
Dave


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.