AuthBridge.Clients.AzureAdOAuthClient.GetUserData C# (CSharp) Method

GetUserData() protected method

protected GetUserData ( string accessToken ) : string>.IDictionary
accessToken string
return string>.IDictionary
        protected override IDictionary<string, string> GetUserData(string accessToken)
        {
            AzureAdUserData graph;
            var request = WebRequest.Create($"{_graphApiEndpoint}/me?api-version={_graphApiVersion}");
            request.Headers.Add(HttpRequestHeader.Authorization.ToString(), $"Bearer {accessToken}");
            using (var response = request.GetResponse())
            {
                using (var responseStream = response.GetResponseStream())
                {
                    graph = JsonHelper.Deserialize<AzureAdUserData>(responseStream);
                }
            }

            var userData = new Dictionary<string, string>();
            userData.AddItemIfNotEmpty("id", graph.userPrincipalName);
            userData.AddItemIfNotEmpty("objectId", graph.objectId);
            userData.AddItemIfNotEmpty("username", graph.userPrincipalName);
            userData.AddItemIfNotEmpty("name", graph.displayName);
            return userData;
        }