-
Notifications
You must be signed in to change notification settings - Fork 16
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
Test/add oauth2 cases #88
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Update ESLint configuration to include Prettier plugin and adjust rules for code style consistency. - Add browser and mocha environments to ESLint configuration. - Remove unused crypto and circular reference replacer from oauth2.js. - Simplify axios POST request logic and add proxy support in OAuth2 node. - Include response headers in the message payload for better context. - Adjust tests to reflect changes in oauth2.js and reduce timeout for faster test execution. - Add new test cases for handling different grant types, network failures, custom headers, multiple scopes, and proxy settings.
- Updated the `oauth2.js` node to handle additional edge cases and improve error handling. - Refactored `logger.js` for better readability and consistency. - Added new test cases in `oauth2_spec.js` to cover more scenarios and ensure robustness. - Removed unused dependencies and cleaned up `package.json` and `yarn.lock` files. - Adjusted the `package.json` scripts to include a new `coverage` script for test coverage reporting.
This commit introduces several changes to improve the clarity and functionality of the oauth2 configuration. In the oauth2.json locale file, the tips for debug mode, client credentials, and rejectUnauthorized have been added, and the labels have been updated to be more concise. The oauth2.html file has been updated to include a new debug mode checkbox with corresponding help information, a the labels for client credentials and rejectUnauthorized have been adjusted to match the updated locale file. Additionally, the logger.js file has been removed as it appears to be no longer needed, and the corresponding references to the logger have been added to the oauth2.js file to incorporate logging functionality directly within the OAuth2 node implementation. The debug mode can now be toggled via the node configuration, and the logger is initialized with the debug setting from the config. Lastly, the oauth2.js file has been refactored to include more descriptive logging messages that will aid in debugging and understanding the flow of the OAuth2 node's operations.
This commit introduces several changes to the oauth2 node configuration and handling of OAuth2 flows. The primary addition is the support for the refresh token grant type, which allows the node to obtai new access tokens using a refresh token. Key changes include: - Added a new `refresh_token` field in the oauth2.html file to allow users to input their refresh token. - Updated oauth2.js to handle the new refresh token flow, including generating the appropriate form data and handling the client credentials. - Refactored the `generateOptions` function in oauth2.js to improve readability and maintainability. The function now uses a mapping of grant type to specific handling functions. - Updated the logger.js to allow for an undefined `count` parameter, which means logging will not be limited unless specified. - Enhanced the localization file (oauth2.json) to include the new refresh token field. These changes aim to enhance the node-red-contrib-oauth2 package by providing a more comprehensive and user-friendly OAuth2 implementation.
This commit updates several dependencies to their latest versions, including axios, eslint, and prettier. It also includes adjustments to the codebase to ensure compatibility with the updated dependencies. Notably, the eslint-plugin-n and eslint-plugin-jsdoc have been updated, which required changes to the eslint configuration. Additionally, the Logger.prototype.objectDump method in logger.j has been modified to handle invalid objects more gracefully.
The 'should' library was included in the oauth2-generate-options_spec.js file but was not being used. This commit removes the unnecessary require statement to clean up the code.
- Removed the unused URL import from oauth2.js. - Added URLSearchParams import for handling form data. - Wrapped the credentials retrieval in a try-catch block to handle potential errors. - Changed the response status code to 404 when credentials are not found. - Changed the response status code to 500 for server errors. - Updated the success HTML response to use proper indentation and formatting. - Changed the response status code to 400 when credentials are missing in the token exchange endpoint.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release Notes
Version: [Your Version Number]
Refactor ESLint Configuration and Improve OAuth2 Node Functionality
oauth2.js
.oauth2.js
and reduced timeout for faster execution.Update Dependencies and Refactor OAuth2 Node
oauth2.js
to handle additional edge cases and improve error handling.logger.js
for better readability and consistency.oauth2_spec.js
to cover more scenarios and ensure robustness.package.json
andyarn.lock
files.package.json
scripts to include a newcoverage
script for test coverage reporting.Refactor oauth2.json and oauth2.html for Clarity and Add Debug Mode
rejectUnauthorized
inoauth2.json
.oauth2.html
to be more concise.logger.js
and integrated logging directly intooauth2.js
.Add Refresh Token Support and Refactor OAuth2 Node Options
refresh_token
field inoauth2.html
.oauth2.js
to handle the new refresh token flow.generateOptions
function inoauth2.js
for better readability and maintainability.oauth2.json
to include the new refresh token field.Update Dependencies and Adjust Code for Compatibility
eslint-plugin-n
andeslint-plugin-jsdoc
.Logger.prototype.objectDump
method to handle invalid objects more gracefully.Remove Unused 'should' Require in oauth2-generate-options Tests
oauth2-generate-options_spec.js
.Improve Error Handling and Remove Unused URL Import in oauth2.js