Inhalte aufrufen

Profilbild

Web API accessing programmatically

webapi authorization

Best Answer Marcus Gesing , 04 August 2023 - 12:34

The API documentation is wrong. It's the one for Smartstore 4.2. The one for Smartstore 5 is here. Sorry for the inconvenience.

Go to the full post


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
2 Antworten zu diesem Thema

#1 ertank

ertank

    Member

  • Members
  • PunktPunkt
  • 10 Beiträge

Geschrieben: 04 August 2023 - 12:20

Hello,

 

I am trying to do HMAC-SHA256 authentication as written in here https://smartstore.a... Authentication

I have my code tested using example data and result is correct.

 

When I try to get order list using an URL like https://www.my_own_domain.com/odata/v1/Orders I get error saying

Access to the Web API was denied. Reason: InvalidAuthorizationHeader. Missing or invalid authorization header. Must have the format 'PublicKey:SecretKey'

I am confused because it says PublicKey:SecretKey but I am trying HMAC-SHA256 authentication and I do make sure header information contains all headers written in here https://smartstore.a...6/Code Examples

 

Sample Headers information contains below data in my log files.

2023-08-04 14:02:09.424 INFO      uUtils.Http.Get()-Headers[0]: Accept-Charset:UTF-8
2023-08-04 14:02:09.424 INFO      uUtils.Http.Get()-Headers[1]: SmartStore-Net-Api-PublicKey:e99df9926785c48209016d2f9441d856
2023-08-04 14:02:09.424 INFO      uUtils.Http.Get()-Headers[2]: SmartStore-Net-Api-Date:2023-08-04T14:02:09.285Z
2023-08-04 14:02:09.424 INFO      uUtils.Http.Get()-Headers[3]: Content-MD5:
2023-08-04 14:02:09.424 INFO      uUtils.Http.Get()-Headers[4]: Authorization:SmNetHmac1 73brphlqva3kgfkx7zlh8m0q6l7zbfsb8q4i5zf6tsq=
ContentType and Accept both are set to "application/json"
 
I do not know the Smartstore and just been assigned to develop an application to read orders from it using Web API. So any help is appreciated.
 
Thanks & Regards,
Ertan


#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3831 Beiträge

Geschrieben: 04 August 2023 - 12:34   Best Answer

The API documentation is wrong. It's the one for Smartstore 4.2. The one for Smartstore 5 is here. Sorry for the inconvenience.


Marcus Gesing

Smartstore AG


#3 ertank

ertank

    Member

  • Members
  • PunktPunkt
  • 10 Beiträge

Geschrieben: 04 August 2023 - 15:57

Yes, this seems to be the problem. V5 documentation fixed it. Thank you.


  • stefanmueller gefällt das


Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: webapi, authorization