I have an API that returns a token when I login the app, to use another 
API, it is necessary to send that token by the header for use it,  I have 
this code



HttpClient cliente = new HttpClient();
                                string authorizationValue = "Bearer " + 
"eyJhbGciOiJIUzI1NisInR5cCI6IkpXVCJ9.eyJpZCI6IjVhNzNjMDU4NTMwZTFlNWQ3ODAwZDE3MiIsInN1YiI6ImxvZ2liwiaWF0IjoxNTE4MTI5MDI2LCJleHAiOjE1MTgyMTU0MjZ9.CptezsVuCmn9q7pi26ZsMykST3bm6YkOIg-1AwSI4lk";
                                cliente.DefaultRequestHeaders.Authorization 
= new AuthenticationHeaderValue("Authorization", authorizationValue);
                                var clientePost = await 
cliente.PostAsync(server, new StringContent(jsonObject.ToString(), 
Encoding.UTF8, json));
                                clientePost.EnsureSuccessStatusCode();

                                if (clientePost.IsSuccessStatusCode)
                                {
                                    MessageBox("Done", null);
                                }
                                else
                                {
                                    var content = await 
clientePost.Content.ReadAsStringAsync();
                                }

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to