Aller au contenu principal

Authentification

L'authentification est nécessaire pour accéder à l'API. Pour cela, vous devez obtenir un jeton d'accès en utilisant votre email et votre mot de passe.

Obtenir un jeton d'accès

#!/bin/bash

# Variables
JUNO_URL="https://app.juno.delivery"

EMAIL="[email protected]"
PASSWORD="[email protected]"

LOGIN_BODY="
{
\"username\": \"$EMAIL\",
\"password\": \"$PASSWORD\"
}
"

curl -X POST $JUNO_URL/juno/auth/login -H "Content-Type:application/json" -d "$LOGIN_BODY"

Utiliser le jeton d'accès

Une fois que vous avez obtenu un jeton d'accès, vous pouvez l'utiliser pour accéder à l'API.

#!/bin/bash

# Variables
JUNO_URL="https://app.juno.delivery"
BEARER_TOKEN="" # Remplacer par le jeton d'accès

curl -X GET $JUNO_URL/juno/api/me -H "Content-Type:application/json" -H "Authorization:Bearer $BEARER_TOKEN"