cleanup login function
This commit is contained in:
@@ -23,12 +23,15 @@ class ElixFormsAuthenticationClient {
|
||||
* @throws ElixFormsException Se le credenziali sono errate o c'è un errore server
|
||||
*/
|
||||
public function login(string $username, string $password): string {
|
||||
$this->baseUrl = rtrim($this->baseUrl,'/');
|
||||
$url = "{$this->baseUrl}/services/api/authentication/login/v1";
|
||||
|
||||
try {
|
||||
$response = $this->httpClient->post($url, [
|
||||
'form_params' => [
|
||||
'headers' => [
|
||||
'x-requested-with' => 'XMLHttpRequest',
|
||||
'Content-Type' => 'application/json'
|
||||
],
|
||||
'json' => [
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
]
|
||||
@@ -70,7 +73,7 @@ class ElixFormsAuthenticationClient {
|
||||
try {
|
||||
$response = $this->httpClient->post($url, [
|
||||
'headers' => [
|
||||
'Authorization' => 'Bearer ' . $token,
|
||||
'Authorization' => "Bearer {$token}",
|
||||
'Content-Type' => 'application/x-www-form-urlencoded'
|
||||
]
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user