Authentication
3 min
the pricemoov api uses api keys to authenticate requests generating an authentication token your authentication token carries many privileges, so keep them secure! do not share your key in publicly accessible areas like github, client side code, etc all api requests must be made over https calls made over plain http will fail api requests without authentication will also fail see the error section the default lifetime of jwt tokens is 24h \# generate a token curl location request post 'https /api pricemoov com/login/' \\ \ header 'content type application/json' \\ \ data raw '{"email" "example\@company com","password" "xxxyyyyzzz"}'import requests url = 'https //api pricemoov com/login/' headers = {'content type' 'application/json'} payload = {"email" "example\@company com", "password" "xxxyyyyzzz"} response = requests post(url, headers=headers, json=payload) token = response json()\['token']fetch('https //api pricemoov com/login/', { method 'post', headers {'content type' 'application/json'}, body json stringify({email 'example\@company com', password 'xxxyyyyzzz'}) }) then(response => response json()) then(data => { const token = data token; // do something with the token }) catch(error => console error(error)); using the authentication token to make http requests curl x get \\ h "authorization jwt xxxxxx" \\ https //api pricemoov com/example const axios = require('axios'); const token = 'xxxxxx'; // replace with actual jwt token const url = 'https //api pricemoov com/example'; // replace with actual url axios get(url, { headers { authorization `jwt ${token}` } }) then(response => { console log(response data); }) catch(error => { console log(error); }); import requests token = 'xxxxxx' # replace with actual jwt token url = 'https //api pricemoov com/example' # replace with actual url response = requests get(url, headers={'authorization' f'jwt {token}'}) print(response json()) \<?php $token = 'xxxxxx'; // replace with actual jwt token $url = 'https //api pricemoov com/example'; // replace with actual url $headers = \['authorization jwt ' $token]; $ch = curl init($url); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt httpheader, $headers); $response = curl exec($ch); curl close($ch); echo $response; ?>