s1093
August 3, 2021, 7:15pm
1
Hi,
I have a custom API sitting in a cloud service. I was wondering if forge allows a self-signed certificate.
I read about the options for api.fetch:
https://developer.atlassian.com/platform/forge/runtime-reference/fetch-api/
but either “https.Agent is not a constructor” error or “failed, reason: self signed certificate” error would be returned.
Is there a way to accept self signed certificates when using the uikit?
If yes, could I get an example as to how it can be done?
Thanks
Having a self-signed certificate kinda messes the entire “trust” thing out. The only one that knows that the certificate is trustworthy is you… And since Forge doesn’t have a way for us to import private keys - it doesn’t have a way to verify that the certificate is you and not a bad actor.
Why not use letsencrypt to create your certificate?
2 Likes
remie
August 3, 2021, 7:24pm
3
Have you tried importing Agent from https? As this is standard included in NodeJS, it might actually be available?
import { fetch } from '@forge/api';
import { Agent } from 'https';
const result = await api.fetch("https://example.net/", {
agent: new Agent({
rejectUnauthorized: false,
})
)
const status = await result.status
s1093
August 3, 2021, 9:57pm
4
I tried @remie ’s this method but it returned “— is not a constructor” error. I am going to try letsencrypt to create my certificate.
Thanks for the suggestions