{"id":26010012,"url":"https://github.com/byu-oit/byu-wso2-request","last_synced_at":"2026-04-21T06:02:03.813Z","repository":{"id":19844277,"uuid":"81227738","full_name":"byu-oit/byu-wso2-request","owner":"byu-oit","description":"Utility for making a server to server request using wso2 authentication","archived":false,"fork":false,"pushed_at":"2023-06-20T14:58:26.000Z","size":224,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":32,"default_branch":"main","last_synced_at":"2024-04-14T06:09:58.393Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byu-oit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T16:14:32.000Z","updated_at":"2024-06-21T20:18:22.830Z","dependencies_parsed_at":"2024-06-21T20:18:20.364Z","dependency_job_id":"d2e4582f-284b-463f-ae88-a9a98b8b2d7c","html_url":"https://github.com/byu-oit/byu-wso2-request","commit_stats":{"total_commits":150,"total_committers":14,"mean_commits":"10.714285714285714","dds":0.72,"last_synced_commit":"c1d0ffed7039d292a309d6ce4ff0a7686fb39864"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fbyu-wso2-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fbyu-wso2-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fbyu-wso2-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byu-oit%2Fbyu-wso2-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byu-oit","download_url":"https://codeload.github.com/byu-oit/byu-wso2-request/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242014702,"owners_count":20057879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T22:26:50.381Z","updated_at":"2026-04-21T06:02:03.718Z","avatar_url":"https://github.com/byu-oit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![BYU logo](https://www.hscripts.com/freeimages/logos/university-logos/byu/byu-logo-clipart-128.gif) byu-wso2-request\nUtility for making a server to server request using wso2 authentication\n\n[![codecov](https://codecov.io/gh/byu-oit/byu-wso2-request/branch/main/graph/badge.svg?token=nzJwvKNRGk)](https://codecov.io/gh/byu-oit/byu-wso2-request)\n\n**Requires Node 10+**\n\n#### Installation\n```npm i --save byu-wso2-request```\n\n#### Migration from v1 to v2.1+\n* Update to Node 8 or above\n* Use promises instead of callbacks for `request`\n\n#### Migration from v2 to v3\n* Update to Node 10 or above\n* If you want the `statusCode` property added to responses, make the requests with the `resolveWithFullResponse` option set to `true` (See: [#30](https://github.com/byu-oit/byu-wso2-request/pull/30))\n\n#### Usage\n\nSet up with `setOauthSettings` and then make requests with `request`\n\nExamples:\n```js\nconst wso2 = require('byu-wso2-request')\n\n(async () =\u003e {\n  // Will default to api.byu.edu if host is not passed in\n  const production = process.env.ENVIRONMENT_NAME === 'prd'\n  const host = production ? 'api.byu.edu' : 'api-sandbox.byu.edu'\n  \n  // Alternatively, you can set the host in the environment variables\n  // process.env.WSO2_HOST = 'api.byu.edu'\n\n  // Do this once on startup\n  await wso2.setOauthSettings('myClientKey', 'myClientSecret', { host })\n  \n  // After that, make all the requests you want\n  try {\n    // Simple GET request\n    const response1 = await wso2.request({ url: `https://${host}/echo/v1/echo/test` })\n\n    // Request using another method\n    const response2 = await wso2.request({ method: 'PUT', url: `https://${host}/byuapi/students/v2/123456789/enrolled_classes/Summer2019,BIO,100,001`, body: { credit_hours: 3 } })\n    \n    // Request that passes along an original JWT\n    const response3 = await wso2.request({ url: `https://${host}/echo/v1/echo/test` }, 'some original jwt to pass along')\n    \n    // Request where you want to know what status code came back (instead of just rejecting if it's not 2XX)\n    const response4 = await wso2.request({ url: `https://${host}/echo/v1/echo/test`, simple: false, resolveWithFullResponse: true })\n  } catch (e) {\n    console.error(e) // Handle errors\n  }\n})\n```\n\nFor more information on the options you can use for the `request` function, see [request-promise](https://www.npmjs.com/package/request-promise)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fbyu-wso2-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyu-oit%2Fbyu-wso2-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyu-oit%2Fbyu-wso2-request/lists"}