최근 검색
최근 검색 없음

Ismail Faizi
가입한 날짜: 2022년 11월 18일
·
마지막 활동: 2022년 11월 18일
팔로잉
0
팔로워
0
총 활동 수
6
투표
1
가입 플랜
1
활동 개요
배지
문서
게시물
커뮤니티 댓글
문서 댓글
활동 개요
님의 최근 활동 Ismail Faizi
Ismail Faizi님이 에 댓글을 입력함
For anyone having this issue. The following is working both locally and when installed:
const metadata = await client.metadata();
const apiUrl = metadata.settings.apiUrl;
const settings = {
url: 'https://' + apiUrl + '/' + path + (queryParams ? '?' + queryParams : ''),
secure: !!metadata.installationId,
cors: false,
type: 'GET',
dataType: 'json',
contentType: 'application/json',
headers: {
Authorization: `Basic ${ !!metadata.installationId ? '{{setting.apiToken}}' : metadata.settings.apiToken }`,
},
accepts: "application/json",
};
return client.request(settings)
.then(successHandler)
.catch(handleFailure);
The `installationId` will be `0` when the app is running locally.
댓글 보기 · 2022년 11월 18일에 게시됨 · Ismail Faizi
0
팔로워
1
투표
0
댓글
Ismail Faizi님이 에 댓글을 입력함
Thank you for your answer Ahmed Zaid. That is very unfortunate. Do you know whether there is a way to find out whether the app is running locally? Knowing so will allow me to make an "insecure" request locally and use secure settings when it is not local.
댓글 보기 · 2022년 11월 18일에 게시됨 · Ismail Faizi
0
팔로워
0
투표 수
0
댓글
Ismail Faizi님이 에 댓글을 입력함
Hello,
I'm experiencing this issue in a Zendesk support app where I need to use a third-party API requiring HTTP Basic authentication. The issue is so far only locally and I've not yet tried to install the app. The following is code that makes the request:
const metadata = await client.metadata();
const apiUrl = metadata.settings.apiUrl;
const settings = {
url: 'https://' + apiUrl + '/' + path + (queryParams ? '?' + queryParams : ''),
secure: true,
cors: false,
type: 'GET',
dataType: 'json',
contentType: 'application/json',
headers: {
Authorization: 'Basic {{setting.apiToken}}',
},
accepts: "application/json",
};
return client.request(settings)
.then(successHandler)
.catch(handleFailure);
And this is how my `menifet.json` look like:
{This is not a new app. I'm changing the API endpoints in an existing app.
"name": "...",
"author": {
"name": "...",
"email": "...",
"url": "..."
},
"defaultLocale": "da",
"private": true,
"location": {
"support": {
"nav_bar": "assets/index.html"
}
},
"version": "0.9.12",
"frameworkVersion": "2.0",
"domainWhitelist": ["{{setting.apiUrl}}"],
"parameters": [
{
"name": "apiUrl",
"type": "url",
"required": true,
"secure": false,
"default": "..."
},
{
"name": "apiToken",
"type": "password",
"required": true,
"secure": true,
"default": "..."
}
]
}
댓글 보기 · 2022년 11월 18일에 게시됨 · Ismail Faizi
0
팔로워
0
투표 수
0
댓글