Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVP-239: DevHub Tweaks #41

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion techdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This npm package offers the CSS (Common Hosted Single Sign-on) API Account functionality through easy to use functions in your NodeJS application. The CSS API Account is part of the B.C. government's Single Sign-On SSO (CSS) service and is used to manage your SSO integrations through code instead of through the dashboard. This can be used to add or remove user roles and much more. Endpoints in the CSS API are offered as JavaScript functions in this package.

- Built for a NodeJS:20 React app.
- Built for a NodeJS:20.
- For [CSS] Teams with a [CSS API Account].
- Works with Vanilla JavaScript or TypeScript 5.
- Built for standalone use. Does NOT require [@bcgov/citz-imb-sso-react] or [@bcgov/citz-imb-sso-express]
Expand Down
5 changes: 5 additions & 0 deletions techdocs/docs/using-the-package/module-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

These are the functions and types exported by the package.

Functions are modeled after the API endpoints of the [CSS Swagger Docs].

```JavaScript
import {
getIntegration, // Get integration details.
Expand Down Expand Up @@ -33,3 +35,6 @@ import {
GitHubUserQuery, // Query type when using getGitHubBCGovUsers or getGitHubPublicUsers.
} from '@bcgov/citz-imb-sso-css-api';
```

<!-- Reference links -->
[CSS Swagger Docs]: https://api.loginproxy.gov.bc.ca/openapi/swagger
21 changes: 21 additions & 0 deletions techdocs/docs/using-the-package/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,24 @@ Sometimes issues may arise when using the packages for the first time, or when u
If an issue persists after following all the proper setup guides, you can set `DEBUG` and `VERBOSE_DEBUG` environment variables to `true` to get more detailed console logs. These logs may help you spot an issue such as a bad response from the CSS API.

If you can't resolve the problem yourself, open a [Bug Report](https://github.com/bcgov/citz-imb-sso-css-api/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Bug%3A+) and mention any issues you've found in your troubleshooting.

<br />

## Common Issues

### Function Results in a `Promise { <pending> }`

Each of the functions provided by this package are asynchronous. This means that the function will run in the background without blocking other events from running, and then once the funtion has completed, it will return the result.

If the function you are trying to use is returning `Promise { <pending> }` it is because you are not awaiting the result of the async function.

Make sure your call to the function is within an `async` function or that async functions can be awaited at the top level of your file, and that the function is proceeded by the `await` keyword. Alternatively, you can use the promise chaining syntax such as `getIntegration().then(result => console.log(result));`

If you wish to resolve multiple functions at once, an option is to use `Promise.all` like in the example below:

```JavaScript
const [integration, roles] = await Promise.all([
getIntegration(),
getRoles()
]);
```
Loading