TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sivakumar
NA
551
218.5k
how to use authorization to get details using access token
Sep 14 2015 3:46 AM
Hi,
I want to get values using access token.
after i am login get a access token using that access token to get a values.
This is my code :
string URI;
string email = ConfigurationSettings.AppSettings["email"].ToString();
string password = ConfigurationSettings.AppSettings["password"].ToString();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void submit_Click(object sender, EventArgs e)
{
URI = string.Concat(host_textbox.Text, api_textbox.Text);
GetLogin();
}
#region Methods
private async void GetLogin()
{
using (var client = new HttpClient())
{
var login = new LoginData() { Email = email, Password =password };
var response = await client.PostAsJsonAsync(URI, login);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
if (response.IsSuccessStatusCode)
{
var productJsonString = await response.Content.ReadAsStringAsync();
LoginData loginObj= JsonConvert.DeserializeObject<LoginData>(productJsonString);
Body_textBox.Text = productJsonString;
}
else
{
var GetResponse = await client.GetAsync(URI);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
if(GetResponse.IsSuccessStatusCode)
{
var getjsonstring = await GetResponse.Content.ReadAsStringAsync();
TeamMemberData team = JsonConvert.DeserializeObject<TeamMemberData>(getjsonstring);
//JsonConvert.DeserializeObject<TeamMemberData>(getjsonstring);
Body_textBox.Text = getjsonstring;
}
}
}
}
private void Body_textBox_TextChanged(object sender, EventArgs e)
{
}
}
#endregion
}
i want to get a values using access token:
screenshot shows a access token like below :
Please give me a help
Thank you.
Reply
Answers (
1
)
How to send token as parameter to get a details
problem in highchart script to print chart in client side