React Native
React Native
Shopware Digest Authentication
See more Shopware Examples
Demonstrates using Digest access authentication for Shopware.Chilkat React Native Downloads
import { Http, JsonObject, StringBuilder } from '@chilkat/react-native'
async function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = new Http();
// To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
http.login = 'api_username';
http.password = 'api_key';
http.digestAuth = true;
const sbResponseBody = new StringBuilder();
try {
await http.quickGetSbAsync('https://my-shopware-shop.com/api/articles?limit=2', sbResponseBody);
} catch {
console.log(http.lastErrorText);
return;
}
const jResp = new JsonObject();
jResp.loadSb(sbResponseBody);
jResp.emitCompact = false;
console.log('Response Body:');
console.log(jResp.emit());
}