# GPGS login question

**URL:** <https://forums.solar2d.com/t/gpgs-login-question/351560>\
**Category:** Game Networking\
**Created:** [June 9, 2020, 4:53am UTC](https://forums.solar2d.com/t/gpgs-login-question/351560 "2020-06-09T04:53:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmorris789](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jmorris789](https://forums.solar2d.com/u/jmorris789)\
**Post date:** [June 9, 2020, 4:53am UTC](https://forums.solar2d.com/t/gpgs-login-question/351560/1 "2020-06-09T04:53:44Z")

</div>

I’ve implemented Google Play Services and can successfully login etc. There are times when my devices signal isn’t great and the auto login isn’t successful. I fix it by restarting the app and the second attempt usually works but I don’t expect the end user to try this method.

My question is what would be the best way to handle this. Are there any downsides to starting a timer and re-attempting to login every 5 seconds for a certain number of attempts? Are there any best practices or advice someone can give me on how this is usually managed?

---

<div class="post-metadata">

**Author:** ![troylyndon](https://forums.solar2d.com/user_avatar/forums.solar2d.com/troylyndon/32/313_2.png) [@troylyndon](https://forums.solar2d.com/u/troylyndon)\
**Post date:** [June 9, 2020, 8:28am UTC](https://forums.solar2d.com/t/gpgs-login-question/351560/2 "2020-06-09T08:28:32Z")

</div>

@jmorris - when the login is unsuccessful, does it return to the callback routine, or does it timeout?

---

<div class="post-metadata">

**Author:** ![jmorris789](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@jmorris789](https://forums.solar2d.com/u/jmorris789)\
**Post date:** [June 11, 2020, 2:08pm UTC](https://forums.solar2d.com/t/gpgs-login-question/351560/3 "2020-06-11T14:08:28Z")

</div>

The gpgs.loginListener gets called and the event.errorMessage is “sign in required”, it only happens 10 percent of the time. The first login is handled as “userInitiated=true” which works prompting which account to use. I save a variable to file “userPref=event.phase” and opening the app afterwards attempts to login silently which works 9 out of 10 times with a successful login, there’s just that random time when it doesn’t login and the app continues to load. A quick restart of the app resolves the problem.

Would it be ok to re-attempt login inside the listener after confirming the error is “sign in required”?
