Rest API for Mobile APP is not working

Hello,

I have an issue and could not find any rich documentation for the mobile app, something is missing and I found all customers go with a new app builder but I want to use the cs cart native app

The problem is simply, the app is working with the demo cs-cart data, and once I add my apiKey, baseUrl and siteUrl, the app stops working.

API key is configured on the backend, the evidence is that, when I add the below hardcoded data, the app is working normally and fetch all data.

//const username = ‘example@gmail.com’
//const password = ‘KXXFQksjaoqiZ3dV46V0G7K0W’
const encodedCredentials = base64.encode(${username}:${password})
newConf.headers.common.Authorization = Basic ${encodedCredentials}

what is wrong in the hardcoded data, as you know, all registered customers are redirected to the API Profile and can see all Orders etc

I hope that someone tell me the missing info that was not documented, just to make the life easier :slight_smile:

Thanks,
Sarah

Hi, Sarah.

The mobile application uses its own ApiKey to interact with the SRA. It should be passed via the Storefront-Api-Access-Key header. You can check its value in the database, using this query:

SELECT o.value FROM cscart_settings_objects o
LEFT JOIN cscart_settings_sections s ON o.section_id = s.section_id
WHERE o.name = 'access_key' AND s.name = 'storefront_rest_api'

thanks, we solved it.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.