-
Notifications
You must be signed in to change notification settings - Fork 662
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
Add option to disable state verification #1339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give feedback and thoughts, thank you!
* @param installationStore - Interface to store and retrieve installation data from the database | ||
* @param authVersion - Can be either `v1` or `v2`. Determines which slack Oauth URL and method to use | ||
* @param logger - Pass in your own Logger if you don't want to use the built-in one | ||
* @param logLevel - Pass in the log level you want (ERROR, WARN, INFO, DEBUG). Default is INFO | ||
*/ | ||
export class InstallProvider { | ||
public stateStore: StateStore; | ||
public stateStore?: StateStore; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When stateVerification = false
a stateStore is not necessary anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment on A TODO. Looks great to me. Squash commits when merging this 👋
@@ -546,6 +579,7 @@ export interface CallbackOptions { | |||
export interface StateStore { | |||
// Returned Promise resolves for a string which can be used as an | |||
// OAuth state param. | |||
// TODO: Revisit design. Does installOptions need to be encoded in state if metadata is static? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I were you, I would add something like this:
TODO: With bolt-js built-in receivers, InstallURLOptions
is always static. This means that metadata value is not so useful for customizing OAuth flows per user. If we enhance both this SDK and bolt-js to have a function that accepts request information (e.g., path, headers, query string) plus dynamically generate InstallURLOptions
per request, developers can easily switch not only medatada but also redirect_uri, scopes, and user_scopes to support multiple installation patterns.
* Add option to disable state verification
Summary
This PR partially fixes bolt-js/#1101 by adding the option to disable state verification during OAuth flow via a
stateVerification
flag. By defaultstateVerification = true
. Users can passstateVerification: false
as an OAuth option via AppinstallerOptions
object.Previous (reverted) changes allowed option to disable state verification but continued usage of default state store for state generation. This current set of changes disables the default state store when stateVerification = false.
Requirements (place an
x
in each[ ]
)