Original Message:
Sent: May 25, 2023 11:21 AM
From: alexcv
Subject: Problem with CSRF Token - Aruba Central API
Hello!
Thank you very much for answering. The tool is great!
The thing is that I am programming a mobile application, so I need to make calls to an api with a post method to upload the aruba devices by serial number and mac. In this case, the tool is separate, correct? So I can't use it in my app because I can't make a call to the tool :(.
Thanks in advance!
Original Message:
Sent: May 25, 2023 11:00 AM
From: alagoutte
Subject: Problem with CSRF Token - Aruba Central API
Hi,
What code do you are using ?
you can look PowerArubaCL, there is already (only) this function for Get Devices (Inventory) and also add Device Inventory
------------------------------
PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...
PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)
PowerArubaCL: Powershell Module to use Aruba Central
PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..
ACEP / ACMX #107 / ACDX #1281
Original Message:
Sent: May 25, 2023 04:04 AM
From: alexcv
Subject: Problem with CSRF Token - Aruba Central API
Hello!
I'm having trouble making an Aruba Central API call. I want to make a call where I can add a device knowing its mac and its serial number.
I have two problems in the Aruba API (https://eu-apigw.central.arubanetworks.com/swagger/apps/nms/) there are two categories where I can make this call.
1.- The first is in 'New Device Inventory' --> Add device using Mac and Serial number. It is a POST call with the following URL: 'https://eu-apigw.central.arubanetworks.com/platform/device_inventory/v1/devices' and the error returned is the following:
{
"error_code": 500,
"msg": "Internal Error - Remote Service"
}
2.- On the other hand, we have another category in which to use this call which is 'Deprecated Device Inventory' --> Here I use the URL: 'https://eu-apigw.central.arubanetworks.com/device_inventory/v2 /devices' as indicated in the steps, but I get a different error:
{
"error": "CSRF token missing or incorrect.",
"status_code": 400
}
The problem is that I think the one that works well is number 2 (Deprecated Device Inventory). The thing is that I have followed the steps of the following documentation (https://developer.arubanetworks.com/aruba-central/docs/api-oauth-access-token) and I have obtained the CSRF Token, the session, the auth code and the final access token and the refresh token, but it still doesn't work for me and it always says: "CSRF token missing or incorrect.".
So, I don't know which of the two options I have to use and I don't know how to solve either of the two options. All calls are made from Postman and from my application. The problem is in these calls since I have tried to make calls such as creating a group and it works correctly both from Postman and from my app.
Thank you very much in advance everyone and I hope it can be solved!