GET request using FSharp.Data with a custom header.

11 views
Skip to first unread message

Manoj Waikar

unread,
May 26, 2019, 6:53:09 AM5/26/19
to F# Web Stack
Hi,

We have a REST API and the endpoints required a token to be set which is acquired by making a signIn call (prior to calling any other endpoint).
The name of the custom header that we expect is - "X-Auth-Token".

Now no matter how I call one of the API endpoints which expect a token, I always get an exception - "System.Net.WebException: The remote server returned an error: (401) Unauthorized."

This is the way I make the request -

let token = "qwerr12rtrt..."

type
RepositoryResponse = JsonProvider<"./data/repos.json">
let reposResponse
=
           
Http.RequestString(baseRepoUrl, httpMethod = "GET",
                headers
= [ "X-Auth-Token" token ])


Please let me know if I am missing something here?

Thanks,
Manoj.
Reply all
Reply to author
Forward
0 new messages