Also support object parameter and fix optionals #37
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.
Both the constructor of
FusionAuthClient
and itsexchangeOAuthCodeForAccessToken
now also support calling them with an object instead of separate parameters.This helps when a lot of the parameters are optional (as per the docs).
Completely backwards compatible.
This fixes #36 & makes progress on #29, but I've only amended the methods I needed right now. Feel free to work on it by implementing this for more methods. Also the jsdocs should be amended still. I'd say this could be merged (if approved) already, and make the new approach gradually available.
Examples
This is how the constructor used to work
But the docs state (see
Examples
) you can leave out the API KEY if you don't want it (in the frontend, e.g.). This isn't true as per the types, so I fixed that by introducing the object. This would look like this. You can leave out the key if you don't want it.The same goes for
exchangeOAuthCodeForAccessToken
.Becomes the following, since only the
code
andredirect_uri
are actually required.