public async Task <IPlatformResponse <IAuthorization> > Login(string mojioApiToken, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { if (this.Authorization == null) { this.Authorization = new CoreAuthorization(); } this.Authorization.MojioApiToken = mojioApiToken; this.Authorization.ExpiresIn = int.MaxValue; return(await SdkClient.Login(this.Authorization)); }
public async Task <IPlatformResponse <IAuthorization> > Login(string username, string password, string scope = "full", CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SdkClient = Container.Resolve <IClient>(); var result = await SdkClient.Login(username, password, scope, cancellationToken, progress); Authorization = result.Response; if (!string.IsNullOrEmpty(Authorization?.MojioApiToken) && !Authorization.HasExpired && _authManager != null) { await _authManager.SaveAuthorization(result.Response); } return(result); }
public async Task <IPlatformResponse <IAuthorization> > Login(IAuthorization authorization, CancellationToken?cancellationToken = null, IProgress <ISDKProgress> progress = null) { SetupTokenAndProgress(cancellationToken, progress); var result = await SdkClient.Login(authorization, cancellationToken, progress); Authorization = result.Response; if (_authManager != null && (authorization?.Signature != Authorization?.Signature) && !string.IsNullOrEmpty(authorization?.Signature) && !string.IsNullOrEmpty(Authorization?.Signature)) { await _authManager.SaveAuthorization(Authorization); } return(result); }