Created
December 4, 2021 00:33
-
-
Save tannerlinsley/ffde458359ee79ee9048db7d7a25921f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"message": [ | |
"Requesting backblaze auth..." | |
], | |
"level": "log", | |
"timestamp": 1638577536200 | |
}, | |
{ | |
"message": [ | |
"btoa error", | |
"{}" | |
], | |
"level": "log", | |
"timestamp": 1638577536200 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getBackblazeAuth() { | |
console.log('Requesting backblaze auth...') | |
let authKeys = '' | |
try { | |
authKeys = btoa( | |
`${process.env.BACKBLAZE_APP_ID}:${process.env.BACKBLAZE_APP_KEY}`, | |
) | |
} catch (err) { | |
console.log('btoa error', JSON.stringify(err)) | |
} | |
console.log('Accessing backblaze api...') | |
const { data } = await axios.get<BackblazeAuthResponse>( | |
`https://api.backblazeb2.com/b2api/v2/b2_authorize_account`, | |
{ headers: { Authorization: `Basic ${authKeys}` } }, | |
) | |
return data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment