GPSLogger Authentication error Mosquitto MQTT

Hi
i setup HA with gpslogger an got this error trying to connect from my smartphone
New connection from xxx.xxx.xxx.xxx on port 1883. Socket error on client , disconnecting.

the i moved to https a got this error:
[homeassistant.components.http.view] Serving /api/gpslogger to xxx.xxx.xxx.xxx (auth: False) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from xxx.xxx.xxx.xxx

the connection from HA works fine:
New connection from 172.30.32.1 on port 1883. New client connected from 172.30.32.1 as xxxxxxxx-c599-40da-ba81-xxxxxxxxxxxx (c1, k60, u'user').

For the setup i folowed this howto:

I dont get this:
ā€œ0.77+ If you are using Long-Lived access tokens, then add Authorization: Bearer LLAT to the HTTP Headers setting (replace LLAT with your Long Lived Access Token).ā€

how exactly do i need to setup the authentication or the LLAT in the GPSLogger APP?

My Home Assistant release is 0.81.2

My relevant entry in the configuration.yaml

device_tracker:
- platform: gpslogger

regards

In HA, click on your user account (top left on home screen), scroll to bottom of that page and find the LLAT card, there you generate a LLAT, name it smt usefull and copy the generated LLAT.

in the android app, go to the side menu / Logging Details and toggle the switch, it will bring up the details screen.
select HTTP Headers and add add
Authorization: Bearer LLAT
to the HTTP Headers (replace LLAT with your Long Lived Access Token).

Thatā€™s how itā€™s supposed to work, but YMMVā€¦

i did that how you said an it looks like this:
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer myLLAT

but still doesent work
the HA logs says:
Login attempt or request with invalid authentication from xxx.xxx.xxx.xxx

ok.
I had the exact same issue 24 hours ago.

If things are as expected, your LLAT will be a ginormous string of 183 charactersā€¦ impossible to type into the app.
Find a way to send it from your computer to your phone (email, Google Keep, ā€¦ ) and paste it right after Authorization: Bearer
Or, perhaps, generate your LLAT from the phoneā€™s browser and copy/paste it.

The error you are getting is 99% due to the LLAT being wrong in the app.

i use copy/paste for the LLAT string - no typing. but no change ti get it work.
any other ideas?

all i can say is, try another way to get the LLAT in the HTTP headers.

Also, be careful with spaces, or other invisible characters.
Make sure you put an ā€˜enterā€™ before the Authorization header.

Have you checked the ip_bans.yaml file, itā€™s in the folder together with your HA configuration.yaml
Perhaps your phone got banned for consecutive auth failures ?

For reference, hereā€™s my headers (with modifications to the LLAT) :

Content-Type: application/x-www-form-urlencoded
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpcABCDEFGMDBhZTU0Mzc2NmY0NOTHINGHERE2YWI4MWM2MGI2NiIsImlhdCI6MTU0MTg1MDgxMywi12345667890U3MjEwODEzfQ.qgb0QJUE6cLe1mI-qlwHJhO_a6CuClbvzZRcUVmZLbE
1 Like

there is no ip_bans.yaml file.
my header looks exactly like your ( i put an ā€œenterā€)
but still doesent work
i have the log level on debug but only the warring message is been logged. how can i get more info on loging?

what happens when you push on ā€œValidate SSL Certificateā€ in the Log to custom URL settings in the app ?

The app also offers logging, in the main screen, select Log View instead of Simple View.
Perhaps thereā€™s some interesting info thereā€¦?

GPSLogger doesnā€™t log to MQTTā€¦

the Logging in the app says:
ERROR CustomUrlJob.onRun:86 - Unexpected response code Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://mydomain.com/api/gpslogger?latitude=31.000013654957606&longitude=18.999994316254664&device=1163411979&accuracy=12.0&battery=80.0&speed=0.8&direction=1.059355&altitude=20.0&provider=network&activity=}

when i push on ā€œValidate SSL Certificateā€ in the Log to custom URL settings in the app it says that the certificate is valid

just making sure, you edited this prior to posting and it isnā€™t exactly what you have in the appā€™s config, right?
Otherwise, i donā€™t see how your HA could be complaining about invalid authentication, and also otherwise the app would throw an error on the SSL validation.

For reference, my URL is :
https://blablabla.duckdns.org:8123/api/gpslogger?latitude=%LAT&longitude=%LON&device=Android&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT

Moving onā€¦ please explain exactly what tools you are using to enter the LLAT into the Headers config ?

https://mydomain.com/
this is edited an not my real domain :slight_smile:

i open this post on my phones firefox browser and do copy/paste the URL to the GPSLogger app. then i edit the URL, delete blabla.duckdns.org:8123 and write my correct domain in the URL.

And for the LLAT, you also did this on the phoneā€™s browser ?

Running out of things to try here, tbh.
OTOH the error message you have is pretty specificā€¦

that ip address is confirmed to be your phoneā€™s ip ?

yes, i did the same with the LLAT and yes the xxx.xxx.xxx.xxx is the ip of my phone.

iā€™m wondering if thereā€™s something wrong in your HA config file, since you seem to be thinking this is related to MQTT.
But, as @flamingm0e said : GPS Logger is not an MQTT thing.

For reference the related portion of my configuration.yaml :

################        DEVICE TRACKERS    ################
device_tracker:
  - platform: gpslogger
################        END DEVICE TRACKERS    ################

i donā€™t know if the indentation would make a differenceā€¦

@hubgitbb how are you connecting to HA, do you have a reverse proxy? or do you connect directly?

i did a fresh install from scratch and now it works with the same settings.

Iā€™m having the same exact problem. Tried a fresh install on GPS Logger and still get a 401 error. Iā€™ve tried everything with the LLAT but it doesnā€™t seem to like it.

it sounds like you have your line formatted incorrectly.

In the http header box, hit enter after x-www-form-urlencoded,
then type Authorization: Bearer yourLLAT