예제 #1
0
        /// <summary>
        /// Create a Client with and bind it to the specified username.  This request will fail if the User
        /// specified by <c>username</c> is already bound to a Client.
        /// </summary>
        /// <param name="username">The username of the User to bind to the new Client.</param>
        /// <param name="firstName">The client's first/given name.</param>
        /// <param name="lastName">The client's last/family name.</param>
        /// <param name="userCredentialsCallback"></param>
        /// <returns></returns>
        public async Task <string> CreateClient(string username,
                                                string firstName,
                                                string lastName,
                                                UserCredentialsCallback userCredentialsCallback)
        {
            var accessToken = await GetCurrentAccessToken(userCredentialsCallback);

            using (var accountsApi = new AccountsApiClient(_accountsApiUrl, accessToken))
            {
                var clientId = await accountsApi.CreateClient(username, firstName, lastName);

                return(clientId);
            }
        }