Example #1
0
        private void btnRemote_Click(object sender, EventArgs e)
        {
            var uri = new Uri(UGConstants.SSO.TokenEndpoint);
            var client = new OAuth2Client(uri, UGConstants.SSOClient.ClientId, UGConstants.SSOClient.ClientSecret);

            var result = client.RequestResourceOwnerPasswordAsync(txtUserName.Text, txtPassword.Text, "openid profile");

            UserAccessInfo.AccessToken = result.Result.AccessToken;
        }
Example #2
0
        public TokenResponse RequestToken(UserAuthen user)
        {
            string urlToken = UGConstants.SSO.TokenEndpoint;
            var client = new OAuth2Client(new Uri(urlToken)
                , UGConstants.SSOClient.ClientId
                , UGConstants.SSOClient.ClientSecret);

            return client.RequestResourceOwnerPasswordAsync(user.UserName, user.Password, "openid profile email").Result;//write
        }