-
Notifications
You must be signed in to change notification settings - Fork 108
Send notification email when granting tokens with the "oldsync" scope #2880
Description
Edited 2019-03-12: Based on discussion below, I'm splitting this up into separate issues. Let's use this bug for sending a notification email and a different bug for sending the push notification, since I think they can be approached independently.
New scope for this bug:
When a new client connects to sync, we need to send an email to the user for visibility. This currently does not happen for clients that get sync access by requesting the "oldsync" OAuth scope with an existing session token. The simplest way to do the right thing here is to send the email at the point where the new client exchanges its OAuth code for tokens bearing the "oldsync" scope.
Requires #2954 or similar functionality, so that the code->token exchanges happens in a place where we can send an email.
Original issue description:
This is going to be a little thorny, but it's one of the things that motivated our work to combine auth-server and oauth-server, so let's figure it out...
When a new device connects to sync, we currently alert the user via two mechanisms:
- We send an email telling them a new device was connected to Sync
- We send a push notification to their existing devices, which display a "now syncing with XYZ popup".
These notifications are currently triggered during the creation of a new sessionToken. With the pairing flow a new device gets connected without creating a new sessionToken, we will instead have to trigger them when the supplicant does the OAuth code exchange and obtains its OAuth tokens.
I see two options, but perhaps y'all can suggest others.
- In the oauth-server, when it does the code/token exchange for something requesting the "oldsync" scope, have it sent some backchannel notification to the auth-server to trigger the notifications.
- Expose the code/token exchange endpoint on the auth-server and require that sync clients do their code exchange there rather than on the oauth-server, and have that route manage notifications as appropriate.
I lean towards (2) because it furthers the auth/oauth merger story, but it could require some updates to existing clients that are obtaining "oldsync" scoped tokens directly the oauth-server.
@vladikoff thoughts?