Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to receive an update notification when a user enables 2-step verification?

Tags:

I have created a channel to send my app notifications when a user is updated like so:

data = {     'id': channel_id,     'type': 'web_hook',     'address': domain_address,     'kind': 'api#channel', } channel = directory.users().watch(body=data, domain=my_domain, event='update').execute() 

This successfully sends notifications when I update the user in the Admin SDK GUI. However, when a user takes an action that causes their information to update, such as logging in, changing their password or enabling 2-step verification, I receive no notification.

My end goal is to receive a notification when a user enables 2-step verification, i.e. when the isEnrolledIn2Sv attribute changes from False to True. Is there any way of doing this?

Thank you!

EDIT: The workaround I used was to create a webhook (I used AWS Lambda) to query all users known to have the isEnrolledIn2Sv attribute set to False, and see if any had changed to True. It works! But not ideal, so would love to hear if anyone else knows a cleaner way to do this.

like image 342
MaryKN Avatar asked Jun 19 '17 22:06

MaryKN


People also ask

How does Google two-step verification work?

2-step verification adds an extra layer of security to your Google Account. In addition to your username and password, you'll enter a code that Google will send you via text or voice message upon signing in.

Can you turn off 2 step verification Gmail?

Manage your Google Account. At the top, tap Security. Under "Signing in to Google," tap 2-Step Verification. You might need to sign in. Tap Turn off.


1 Answers

In addition to 'update', it looks like you want to request 'add' events, as well.

like image 196
J_H Avatar answered Apr 05 '23 11:04

J_H