canvas-request
Advanced tools
Comparing version 0.0.1 to 0.0.2
13
index.js
@@ -26,2 +26,3 @@ /* | ||
var AWS; | ||
var CANVAS_URL; | ||
var parameter_header; | ||
@@ -40,2 +41,7 @@ var ssm; | ||
ssm = new AWS.SSM(aws_config); | ||
if(!config.canvas_url) { | ||
throw("Missing canvas_url in config") | ||
} else { | ||
CANVAS_URL = config.canvas_url; | ||
} | ||
if(config.aws.aws_params_location == 'file') { | ||
@@ -53,2 +59,7 @@ var credentials = new AWS.SharedIniFileCredentials({profile: 'default'}); | ||
} else if(config.credential_method == 'env_vars') { | ||
if(!config.canvas_url) { | ||
throw("Missing canvas_url in config") | ||
} else { | ||
CANVAS_URL = config.canvas_url; | ||
} | ||
if(process.env.CANVAS_CLIENT_ID && process.env.CANVAS_CLIENT_SECRET && process.env.CANVAS_REFRESH_TOKEN) { | ||
@@ -103,3 +114,3 @@ CANVAS_CLIENT_ID = process.env.CANVAS_CLIENT_ID; | ||
request({ | ||
url: 'https://byu.test.instructure.com/login/oauth2/token?refresh_token='+ CANVAS_REFRESH_TOKEN + '&grant_type=refresh_token', | ||
url: 'https://' + CANVAS_URL + '/login/oauth2/token?refresh_token='+ CANVAS_REFRESH_TOKEN + '&grant_type=refresh_token', | ||
method: 'POST', | ||
@@ -106,0 +117,0 @@ headers: { |
{ | ||
"name": "canvas-request", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "npm module for making api requests to canvas", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20
test.js
@@ -22,12 +22,16 @@ /* | ||
// var canvas_token = '<place your canvas token here>' | ||
// var canvas_config = { | ||
// // 'token': canvas_token, // If you include the token in the config, you don't need the CANVAS_CLIENT_ID, CANVAS_CLIENT_SECRET or the CANVAS_REFRESH_TOKEN. Omit to use aws_ssm or env_vars | ||
// 'credential_method': 'aws_ssm', // Either aws_ssm or env_vars | ||
// 'canvas_url': 'byu.test.instructure.com', | ||
// 'aws': { // include if using aws_ssm | ||
// 'parameter_header': 'lms-event-integration.dev', | ||
// 'region': 'us-west-2', | ||
// 'aws_params_location': 'file' // Either file (~/.aws/credentials) or env_vars | ||
// } | ||
// } | ||
var canvas_config = { | ||
// 'token': canvas_token, // If you include the token in the config, you don't need the CANVAS_CLIENT_ID, CANVAS_CLIENT_SECRET or the CANVAS_REFRESH_TOKEN. Omit to use aws_ssm or env_vars | ||
'credential_method': 'aws_ssm', // Either aws_ssm or env_vars | ||
'aws': { // include if using aws_ssm | ||
'parameter_header': 'lms-event-integration.dev', | ||
'region': 'us-west-2', | ||
'aws_params_location': 'file' // Either file (~/.aws/credentials) or env_vars | ||
} | ||
'token': process.env.TOKEN | ||
} | ||
var requestOptions = { | ||
@@ -34,0 +38,0 @@ 'url': 'https://byu.test.instructure.com/api/v1/accounts/1/users', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22573
193
9