last day (14 days later) » 

12:59 PM
0
A: how to get the access token programatically?

federico scamuzziHave you tried myabe to put return Task.FromResult< ResponseTO >(new ResponseTO{ //your properties filled }); so something like: public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { var allowedOrigin = context.OwinCo...

 
how do I add the access_token value to header?
 
AuthenticationProperties properties = CreateProperties(user.UserName); AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties);ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(userManager, OAuthDefaults.AuthenticationType);context.Validated(ticket); context.Request.Context.Authentication.SignIn(oAuthIdentity)‌​;
 
If you don't mind, can you please edit the post & add this snippet??
@I checked, still the same response
 
also with dedit now? context.Response.WriteAsync(JsonConvert.SerializeObject(resp‌​onse, new JsonSerializerSettings { Formatting = Formatting.Indented }));
 
Yes.This is the returned response codepaste.net/j4aokv
 
12:59 PM
sorry but one question...if you don't get back the token...how the lcient can resend it back to the server?
 
If I got your right, You are asking how I am passing the access token currently. Currently the api are under construction & I am using Postman to test my api's so I manually copy the token & use it in the header
Hi
 
yes..but my question is... you want to don't show the token in the api response...but how can the client tomorrow send the token back to the server if you don't send it in the response
 
I am new to WebAPI. the requirement is stated that if the user is valid then add the access token in header & for the subsequent request from the same client I need to fetch the token from the header
So I am thinking that if the user is valid then get the access token value & add it to header under Authorization key
Does it make sense??
there??
 
yes
but you can't ovverride the authentication point
api/token
as you want .. it make no sense
 
1:14 PM
You mean to say I need to return default JSON string ??
I mean to say by default the format that OAuth is returning
& if so the client need to manually pass the token for every Authorized request
 
1:34 PM
yes
exaclty
youcan set in a centralized Angular app
 
But this doesn't look good
Ideally I should returned my ResponseTO & the token related stuff should be appended in the header
One more question I have posted.
0
Q: how to reduce the length of access_token value in OAuth

Kgn-webI am using Token based authentication & here is the sample access_token access_token":"NRUKkI5NjNfrE-7SpVKwBGqBLbKPu8xITkRvY7POP1ixzL06udj7nggUwm_OPAZvyguTGDiomEIRFU4HkWp5AiKu4n54nBQTM2R4cVbfTVVxhkBuCh3DQ7TAJqvVAZqRb8QbGxgVVHry222_w74W9xgaqurWm8n5FL-M-NlCfRWHqT6lBz-K4MpABobb0JGmxIqJpuDE6NZcDlDu5...

:)
 

last day (14 days later) »