Working on Social Login with Traccar Server session api

Furqan Mughal16 days ago

I am working on my Flutter Application with Traccar Server.
I have implemented session api with email & password. I had setup email, password & name while creating a new user. Then that email and password i am later use to automatically sign in user into my application. All working perfectly.
Now, I want to implement social login "Facebook, Google & Apple". I don't know how to handle social login response with Traccar Server. Because as far as i know we must have name, email & password to register new user on Traccar Server.
When my user Singing up with Social Login & he restart's the application i want him to auto login using session api so that he can not has to again and again sign in via social login. Using Social Login i have email, name and a unique identifier from Google or Facebook. So what would be the best approach to archive to register new user also which information i have to use to save in my app so that when user restart's the application he can simply go to Home Screen by passing Login scenario's.
Thanks in Advance.

Anton Tananaev16 days ago

You should probably enable SSO on the server and use SSO provide with support for social logins.

Furqan Mughal16 days ago

I have to add these into my traccar.xml ?

<entry key='openId.enabled'>true</entry>
<entry key='openId.providerUrl'>https://securetoken.google.com/YOUR_PROJECT_ID</entry>
<entry key='openId.clientId'>YOUR_WEB_CLIENT_ID</entry>
<entry key='openId.clientSecret'>YOUR_CLIENT_SECRET</entry>

and then send token into Header like this ?

Authorization: Bearer <FIREBASE_ID_TOKEN>

Right ?

Anton Tananaev16 days ago

It doesn't make sense to me.

Furqan Mughal16 days ago

you said i have to enable SSO. I have searched and got this solution to enable SSO on Traccar Server.

<entry key='openId.enabled'>true</entry>
<entry key='openId.providerUrl'>https://securetoken.google.com/YOUR_PROJECT_ID</entry>
<entry key='openId.clientId'>YOUR_WEB_CLIENT_ID</entry>
<entry key='openId.clientSecret'>YOUR_CLIENT_SECRET</entry>

and then i have to social login using Firebase and then firebase send me token in return of either Facebook, Google or Apple Sign in.
Then i have to pass that token into header like this.

Authorization: Bearer <FIREBASE_ID_TOKEN>

According to your direction i had found this solution.
If you think this is not the right path i am following then guide me a bit. How do i enable SSO ?

Anton Tananaev16 days ago

You can't use the auth token directly as Traccar API token. I recommend checking how the official app handles SSO.

Furqan Mughal16 days ago

No, I mean i will use auth token in session api to get JSessionID and then that JSessionID i will use in other Traccar Server Api's.
Like i am doing right now when i get session using Email & Password.

Anton Tananaev15 days ago

Yeah, but that's not how you use the oauth token. You have to call /session/openid/callback. Again, I strongly recommend check what the official app does.

Furqan Mughal15 days ago

Ok Let me check and get back to you.
Honestly I don't understand your suggestion but I will try.