microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
lib/app-center-node-client/src/appCenterClientCredentials.js
22lines · modecode
| 1 | // |
| 2 | // Custom credentials object for talking to AppCenter |
| 3 | // |
| 4 | |
| 5 | class AppCenterClientCredentials { |
| 6 | constructor(getToken) { |
| 7 | this.getToken = getToken; |
| 8 | } |
| 9 | |
| 10 | signRequest(request, callback) { |
| 11 | this.getToken() |
| 12 | .then(token => { |
| 13 | request.headers["x-api-token"] = token; |
| 14 | callback(null); |
| 15 | }) |
| 16 | .catch((err) => { |
| 17 | callback(err); |
| 18 | }); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | module.exports = AppCenterClientCredentials; |