public void GetAuthorizeUri_CallsDropboxServiceGetAuthorizeUriWithCurrentDropboxAppData()
        {
            var correctUri = new Uri("https://CorrectUri");

            _dropboxService.GetAuthorizeUri(_dropboxAppData.AppKey, _dropboxAppData.RedirectUri).Returns(correctUri);

            Assert.AreSame(correctUri, _viewModel.GetAuthorizeUri());
        }
        private async Task <string> GetDropboxToken()
        {
            var portsList = _dropboxAppData.PortsList;
            var appKey    = _dropboxAppData.AppKey;

            var(challenge, verifier) = GenerateChallengeAndVerifier();
            var code_challenge_method = "S256";
            var redirectUri           = "";

            var code = await DoOrRetryPortSelectionAsync(portsList, async port =>
            {
                redirectUri = $"http://{IPAddress.Loopback }:{port}/oauth2/redirect_receiver";
                var authUri = _dropboxService.GetAuthorizeUri(appKey, redirectUri);
                var authUrl = $"{authUri}&code_challenge={challenge}&code_challenge_method={code_challenge_method}";

                return(await _dropboxHttpListener.StartAsync(authUrl, port));
            });

            var token = await _dropboxCodeExchanger.ExchangeCodeTokenAsync(code, verifier, appKey, redirectUri);

            return(token);
        }
 public Uri GetAuthorizeUri()
 {
     return(_dropboxService.GetAuthorizeUri(_dropboxData.AppKey, _dropboxData.RedirectUri));
 }