Login to UI from another webpage

Dibbs4 years ago

Hi, I'm not sure if this has been covered before - I did search the forums but didn't find anything.

Is it possible to login to the UI from another webpage? Maybe by making a POST request etc.

I have a webpage - non Traccar related and if I have a link\button to say login and it presents a standard form (email/password fields), upon clicking Submit\Login - could it take the user straight into Traccar's UI?

Thanks

Dibs

Dibbs4 years ago

Maybe I should have searched better. LOL

I found https://github.com/vitalidze/traccar-web/issues/40 which looks like it will do what I want.

Thanks

Dibs

Edit - just found found https://www.traccar.org/forums/topic/login-through-api/ which leads me to believe that the link I found above is a fork of Traccar and not Traccar (original).

Anton Tananaev4 years ago

Correct, the first link is not an official version of Traccar.

Dibbs4 years ago

Anton - thanks for the clarity.

Is it possible to go a GET\POST request or login via a URL, effectively bypassing the login page and going to the UI.

Thanks

Dibs

Anton Tananaev4 years ago

Yes, you can use token. Read at the bottom of this page:

https://www.traccar.org/documentation/user-management/

Dibbs4 years ago

Hi Anton,

Thanks for that. I've been reading up on that and similar on the forums - I get the impression that it allows you to login but it's doesn't effectively log the "user" out. I read one post that said if the user clicks back in the browser they go back in.

Is there any way to get the token method to work in the same way as login & logout?

Thanks

Dibs

Anton Tananaev4 years ago

Not sure what you mean. Logout should log you out of a session created with token.

Dibbs4 years ago

Anton - Many thanks for the info. I have a test setup on a Raspberry Pi, I'll give it a whirl on that.

Thanks

Dibs

Don4 years ago

@Dibs
Did you resolve this?
I am facing the same problem (I unable to logout if I use secure traccar (https). It does not log me out.
Please help

TIA

Dibbs4 years ago

Hi Don,

Sorry - it slipped on my list of priorities.

I wanted a user to login to the UI from a different web page using a username & password, which meant (for me) that I needed to manage the credentials securely and allow for changing of them (as Traccar wouldn't - if I've set their account to read-only).

Then the question (in my mind) cropped up of what happens when the password differs from what "my" system holds compared to what is in Traccar - i.e. a login (in theory) should still work when they go thru "my" system as it's using the token to go into Traccar, but if they try to login to Traccar directly, which they could as the "re-direct" would show the URL (having changed the password in "my" system) - they would fail. I could be over-thinking it or gone off at a tangent tho.

Unfortunately, headaches with Teltonika devices got in the way (which I've nearly solved) and programming (headache of) Calamp devices to mimic the functionality of Teltonika devices is still ongoing.

I'm hoping to get back to this login thing in a fortnight or so.

Dibs