Skip to content

Commit

Permalink
Merge pull request #1 from proclame/master
Browse files Browse the repository at this point in the history
Add possibility to use configured API token
  • Loading branch information
adrorocker authored Nov 5, 2020
2 parents b6b8c0d + 90ddfd5 commit 3f24fd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ $api = API\Factory::make(
'<email>'
);
```
* account: set your account ID (can be found in your dashboard URL or when in a DNS zone)
* apiKey: use your Global API key, together with your email address, or use 'api_token' as the email and use a configured API Token.
* email: set your login email in combination with your Global API key, or set as 'api_token' combined with a configured API Token.

Get List of streams:

Expand Down
8 changes: 7 additions & 1 deletion src/Auth/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ public function getEmail()

public function getHeaders()
{
if ($this->getEmail() === 'api_token') {
return [
'Authorization' => 'Bearer ' . $this->apiKey,
];
}

return [
'X-Auth-Email' => $this->getEmail(),
'X-Auth-Key' => $this->getApiKey(),
];
}
}
}

0 comments on commit 3f24fd4

Please sign in to comment.