mitid-integrator
v0.0.1
Published
A lightweight package for interacting with the MitID broker.
Downloads
2
Readme
MitIDIntegrator
A TypeScript class that simplifies authentication processes by managing popup window interactions and message handling.
Key Concept
- Simplifies integration with authentication systems by handling popup window orchestration for user login and message reception.
- Automatically captures authentication codes upon receiving a success message.
Features
- Popup Window Management: Easily open and close popup windows with specified URLs and configurations for a seamless user experience.
- Message Listening: Continuously monitors messages from popup windows, intelligently processing them based on their source and content.
- Authentication Code Handling: Safely captures authentication codes from successful logins and securely passes them to designated callback functions when instructed to close the popup.
Getting Started
Prerequisites
- Environment variables: Ensure the client possesses the requisite environment variables for the MitID broker.
- Callback function: Have a callback function in place to manage the authentication code.
- Window Instance: Have a window instance available for data consumption through the message event.
Installation
npm install my-mitid-broker
Usage
// Initialize MitIDIntegrator
const env = {
BROKER_DOMAIN: "https://mitid-broker.com",
BROKER_CLIENTID: "client-id",
REDIRECT_URI: "https://client.com/callback",
};
const integrator = new MitIDIntegrator();
// Open popup window for login
integrator.openPopup("https://example.com/login", (authCode) => {
console.log("Received authentication code:", authCode);
});
Built With
- TypeScript: Used for static typing and class-based object-oriented programming.
- Node.js: JavaScript runtime built on Chrome's V8 JavaScript engine.
- npm: Package manager for the JavaScript programming language.
Contributing
We welcome contributions from everyone. Before you start, please read our Code of Conduct. We take it very seriously, and expect that you will as well.
How to Contribute
- Fork the repository on GitHub.
- Make your changes in a new git branch on your fork:
git checkout -b my-branch-name
- Commit your changes:
git commit -am 'Add some feature'
- Push your branch to GitHub:
git push origin my-branch-name
- Open a pull request against the main branch on the original GitHub repository.
For more detailed instructions, refer to the GitHub pull request documentation.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards-compatible manner, and
- PATCH version when you make backwards-compatible bug fixes.
For more information on SemVer, please visit semver.org.
Authors
License
MIT License