Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function auth()
- {
- global $api;
- global $config;
- try {
- $response = $api->post('/auth/login', [
- GuzzleHttp\RequestOptions::JSON => ['email' => $config['login'], 'password' => $config['password']]
- ]);
- $content = json_decode($response->getBody()->getContents());
- $token = $content->token;
- setConfig('token', $token);
- $user = request('/user');
- $ucrId = $user->currentCompany->ucrId;
- if (!$ucrId) die('no UCR ID');
- setConfig('UCR', $ucrId);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement