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.4k
Access token shows a null after calling other API
Sep 16 2015 5:31 AM
Hi,
This is my code :
var login = new LoginData() { Email = email, Password = password };
var response = await client.PostAsJsonAsync(URI, login);
var token = response.Content.ReadAsAsync<TokenResponse>(new[] { new JsonMediaTypeFormatter() }).Result;
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
if (response.IsSuccessStatusCode)
{
var productJsonString = await response.Content.ReadAsStringAsync();
LoginData loginObj = JsonConvert.DeserializeObject<LoginData>(productJsonString);
Body_textBox.Text = productJsonString;
}
first time login its generate a access token but calling different api is shows null.
uri like this :
http://localhost:54075/
api/members/login
http://localhost:54075/
api/teams/teamid/?teamid=1
first uri works fine. but second uri shows access token values is null.
Reply
Answers (
0
)
Client side and server side
how to escape implement abstract methods in child class