Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushed data should contain a client secret #70

Closed
bmarty opened this issue Nov 29, 2019 · 11 comments
Closed

Pushed data should contain a client secret #70

bmarty opened this issue Nov 29, 2019 · 11 comments

Comments

@bmarty
Copy link

bmarty commented Nov 29, 2019

In order to support multi accounts on matrix clients, the Push data which are sent to mobile Matrix clients should also contain the user_id a client-secret, to let the app perform a sync on the correct account.

Related issue:

@reivilibre
Copy link
Contributor

reivilibre commented Jul 2, 2020

This is going to require a spec change and it's not clear how it should work with e.g. the event_id_only format.

As a workaround, you could set up the pusher with a custom data attribute (1) which will be sent back to your client (2)

so you can sort of 'implement it yourself' in the meantime...

@bmarty
Copy link
Author

bmarty commented Oct 2, 2020

@reivilibre I've done some test following your suggestion:
I can add more data to the PusherData when configuring the pusher, and then they are probably sent to Sygnal when the homeserver want to send a push, but I do not see those extra data on the Push content I actually receive on the mobile device.

@clokep
Copy link
Member

clokep commented Oct 2, 2020

Looking through Sygnal it seems that only a magic "default_payload" property of the device data is actually sent:

sygnal/sygnal/gcmpushkin.py

Lines 430 to 431 in 53015c7

if device.data:
data.update(device.data.get("default_payload", {}))

@bmarty
Copy link
Author

bmarty commented Oct 2, 2020

Ok, it works, thanks @clokep ! Element Android will use this trick to prepare multi account support.

@varac
Copy link

varac commented Jul 30, 2021

@bmarty Nice - What's the status of multiple accounts on Element Android ?

@bmarty
Copy link
Author

bmarty commented Sep 24, 2021

@varac it's still not planned yet, we're focusing on other features right now

@reivilibre
Copy link
Contributor

I hope this gets implemented soon, so we'll be able to have multiple accounts

Is there a problem with the workaround described above that doesn't work for you?

@DraconicNEO
Copy link

I hope this gets implemented soon, so we'll be able to have multiple accounts

Is there a problem with the workaround described above that doesn't work for you?

Oh sorry, I don't think so, I just read that one of the reasons multiple account support wasn't implemented yet was because of this and since this issue is still open it seems like it hasn't yet been done. Sorry if I caused confusion.

@clokep
Copy link
Member

clokep commented Nov 30, 2021

I think we an close this. 😄

@clokep clokep closed this as completed Nov 30, 2021
@bmarty bmarty changed the title Pushed data should contain the userId Pushed data should contain a client secret Jan 31, 2022
@jittygitty
Copy link

@bmarty For us new guys not as familiar with internals, how exactly can we "implement this ourselves" as @reivilibre said?
"As a workaround, you could set up the pusher with a custom data attribute (1) which will be sent back to your client (2)"
thx!

@reivilibre
Copy link
Contributor

@jittygitty Sorry for not seeing this sooner.

One of your clients can add this into the data attribute
"default_payload":{"my_user_id":"@reivilibre:librepush.net"}
("my_user_id":"@reivilibre:librepush.net" will then come down in all the push messages for that account).

Another client could set
"default_payload":{"my_user_id":"@my_other_account:librepush.net"}

Then your client has something it can read when it receives a push, to determine which account the push is for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants