Example #1
0
        private static async Task AuthorizeImplicitlyInBrowser(OAuthDesktopMobileImplicitGrant auth)
        {
            var browserWindow = new BrowserWindow(auth.GetAuthorizationEndpoint(), auth.RedirectionUri.AbsolutePath);

            browserWindow.Show();

            var redirectUri = await browserWindow.GetRedirectUri();

            auth.ExtractAccessTokenFromUri(redirectUri);
        }
        private static async Task AuthorizeImplicitlyInBrowser(OAuthDesktopMobileImplicitGrant authentication)
        {
            var browserWindow = new BrowserWindow(authentication.GetAuthorizationEndpoint(), authentication.RedirectionUri.AbsolutePath);

            browserWindow.Show();

            var redirectUri = await browserWindow.GetRedirectUri();

            authentication.ExtractAccessTokenFromUri(redirectUri);

            if (authentication.State != ClientState)
            {
                throw new HttpRequestException("The OAuth response state does not match the client request state.");
            }
        }