Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Admin SDK > Directory API > User > LastLoginTime inconsistent

I've written a program that's been in use for a couple of years. Using the API described at https://developers.google.com/admin-sdk/directory/v1/reference/users/list, it simply pulls a list of all users in our Google Apps domain and spits the list out into a csv.

The LastLoginTime field is used for determining which users are no longer logging in so we can remove their account. For two years the program has been running correctly and the value in that field has been accurate, but it looks like some time in February that changed.

Now when I run the program, the field sometimes is populated with the correct data, and sometimes it has some other date in it that is not correct. There's no rhyme or reason as to what's causing this behavior. I'll run the program and it'll have the right information a few times, but I can run it immediately afterward and it'll randomly have the wrong information.

Of note, the user accounts that have the wrong date don't have anything outstanding about them, but dozens or hundreds can be affected. Also, the date that is wrong is consistently wrong (meaning it's always the same wrong date value for a particular account; UserA.LastLoginTime is the consistently wrong value when it's wrong, but different from UserB.LastLoginTime's consistently wrong value; a lot of the time, UserA and UserB will also have the correct value).

So far all that I've done is updated my client libraries to the latest version, but that didn't help.

It seems like something's change on Google's back-end that started this inconsistent behavior... especially considering the code for this program hasn't changed in two years. Is that an accurate statement? If so, is there some documentation somewhere that I can refer to in order to have the field returned consistently and correctly? Google searches so far have been fruitless.

If nothing's changed on Google's side, is there a better approach to achieve a report of inactive users? I'm currently looking to the https://developers.google.com/admin-sdk/reports/v1/guides/manage-audit-login API as a possible option, but rewriting a program that's been working for two years kinda stinks, so a quick fix for what's in place would be preferred.

like image 612
sheppe Avatar asked Dec 12 '25 02:12

sheppe


1 Answers

Google has confirmed that this is a bug in their Admin SDK, and they are currently working on a fix. I'll update this answer once they provide more info.

EDIT Here's the latest from Google:

"I would like to inform you that we received an update today from our Engineering Team regarding the bug that is affecting the lastLoginTime value when using our API. According to the last update received, our Engineering Team has found a potential fix and is beginning implementation. We don’t have an estimated time on when it will be completely fix (sic) however I will keep you updated of any new updates once available."

Final Update: It was a configuration problem on Google's side, and things are now fixed.

like image 82
sheppe Avatar answered Dec 13 '25 16:12

sheppe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!