0

like the title says, I want to extend the VC platform API endpoints with the built in API Authentication (via the API key).

I followed the tutorial to create a managed module, and I can successfully make the API calls. However, it doesn't include any authentication. I am wondering how would I accomplish this?

Another question is that in order to have the VC Storefront to use my custom API endpoints, I would have to generate the module API using the AutoRest on the VC Storefront project, correct?

Thnak you all in advance!

Tony
  • 21
  • 1
  • 3
  • Do I understand the issue correctly: you want your API to be restricted, but now you can access it anonymously. Correct? – eMazeika Mar 06 '19 at 13:23
  • I was actually mistaken. It turned out that I was logging as admin on the VC platform, and tried the API call. Once I cleared the cookie, I can no longer call the API. Yesterday, I actually exposed the custom API endpoints to the VC storefront, and I got the successful return from the API. Cheers :) – Tony Mar 07 '19 at 01:12

1 Answers1

0

VC uses platform API with APIRequestHandler, that uses ApppId and SecretKey to add header to every API request:

request.Headers.Authorization = new AuthenticationHeaderValue("HMACSHA256", signature.ToString());

Then handler is used by every endpoint - link to code.

More info on authentication could be found here: Working with platform API.

Another question is that in order to have the VC Storefront to use my custom API endpoints, I would have to generate the module API using the AutoRest on the VC Storefront project, correct?

Yes, correct.

  • Hi Andrey, thank you for the reply. I actually got it working. I was misunderstood how the module worked. I forgot the module was installed to the Platform and all the endpoints are access via Platform API, so the authentications should work with it. I can all the my endpoints through the Storefront app now :) Thanks! – Tony Mar 07 '19 at 01:15