Upload a TLS Client Certificate to Firebase Cloud Features

I am trying to find out if it is possible to download a TLS client certificate that will be used for my cloud functions in firebase. A TLS client certificate is required by a third-party payment solution called Swish .

This is my first firebase project, and it seems silly that a small problem like this will make the platform unsuitable for me ..

+4
source share
1 answer

After some headache and attempts, I found a fairly simple way to solve swish payments through cloud functions:

request-js , request.post( ) :

const swishOptions = {
url: 'LINK TO SWISH SERVER',
json: true,
pfx: fs.readFileSync('cert.p12'),
passphrase: 'swish',
body: swishRequestBody
}

cert.p12 , index.js, .

rq.post(swishOptions, (err, res) => {
            if (err){
                    console.log('payment creation error: ' + JSON.stringify(err))
                    reject(err)
                }
            if (res){
                    console.log('Payment-token: ' + res.headers.paymentrequesttoken)
                }
        });

- , Swish API, console.log() Swish-.

+4

Source: https://habr.com/ru/post/1684357/


All Articles