Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Reply
Access token shows a null after calling other API
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Sivakumar
9y
471
1
Reply
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.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Client side and server side
how to escape implement abstract methods in child class