Jump to content

.net Api request : error 403


Cyrion

Recommended Posts

Hi!

I try to authenticate and send my first request, but I get the 403 error.
Here is my code, whose ENDPOINT is: "https://api.pulseway.com/v3/"

 

		var ENDPOINT = _configuration["PulsewayService:ENDPOINT"];
		var TOKEN_ID = _configuration["PulsewayService:TOKEN_ID"];
		var TOKEN_SECRET = _configuration["PulsewayService:TOKEN_SECRET"];

		using (var client = new HttpClient())
		{
			client.BaseAddress = new Uri(ENDPOINT);
			var auth = TOKEN_ID + ":" + TOKEN_SECRET;
			var authBytes = Encoding.ASCII.GetBytes(auth);
			client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authBytes));

			var response = await client.GetAsync("devices");
			response.EnsureSuccessStatusCode();

		}


I get the same error with postman.

Have I made a mistake?
Thanks for your help!
Cyril

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...