Lê Văn Hiếu
Lê Văn Hiếu

Reputation: 299

Is There an Admin Google API to Access the 2-Step Verification Setting in the Security Menu of the Google Admin Console?

I want to programmatically access and manage the 2-Step Verification settings (and also another setting in the Security menu) for a specific organization unit in the Google Admin Console. Is there an Admin Google API that provides this functionality? I've reviewed the Admin SDK but couldn't find clear guidance on this. Any help is appreciated.

Upvotes: 0

Views: 79

Answers (2)

4thAnd1
4thAnd1

Reputation: 865

Turn-off 2-step verification using API

Based on the documentation available, there is currently no available API to access things like 2-step verification on an Organizational unit level, however, there is an API available to access these settings on a user level that you can explore, The request looks like these: POST https://admin.googleapis.com/admin/directory/v1/users/{userKey}/twoStepVerification/turnOff you can also take a look at this link: turn-off 2-step verification

this link highlights how you can turn-off 2-step verification, explore this article for more available configuration.

Upvotes: 2

Isha Aggarwal
Isha Aggarwal

Reputation: 452

You can use the Directory API in the Admin SDK to get details if users have 2 step verification enabled or not :

API Request : GET https://admin.googleapis.com/admin/directory/v1/users

Sample Response :

{
  "users": [
    {
      "primaryEmail": "[email protected]",
      "isEnrolledIn2Sv": true,
      "isEnforcedIn2Sv": true
    }
  ]
}

The isEnrolledIn2Sv and isEnforcedIn2Sv properties in the above response will show the user's 2-Step Verification status.

I don't think there is any API that allows you to update this setting for users though. That needs to be done via Google Admin console itself.

Upvotes: 1

Related Questions