Skip to content

Commit

Permalink
Added an event to google login to get notified when the user needs to…
Browse files Browse the repository at this point in the history
… do something (FeroxRev#26)
  • Loading branch information
Yamashi authored and FeroxRev committed Jul 25, 2016
1 parent 2845e75 commit 6269b7d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PokemonGo.RocketAPI/Rpc/Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@

namespace PokemonGo.RocketAPI.Rpc
{
public delegate void GoogleDeviceCodeDelegate(string code, string uri);
public class Login : BaseRpc
{
public event GoogleDeviceCodeDelegate GoogleDeviceCodeEvent;

public Login(Client client) : base(client)
{
}
Expand All @@ -34,6 +37,7 @@ public async Task DoGoogleLogin()
if (_client.AuthToken == null)
{
var deviceCode = await GoogleLogin.GetDeviceCode();
GoogleDeviceCodeEvent?.Invoke(deviceCode.user_code, deviceCode.verification_url);
tokenResponse = await GoogleLogin.GetAccessToken(deviceCode);
_client.Settings.GoogleRefreshToken = tokenResponse?.refresh_token;
_client.AuthToken = tokenResponse?.id_token;
Expand Down

0 comments on commit 6269b7d

Please sign in to comment.