Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Enhancement/custom token fetch fn #29

Merged

Conversation

aguscha333
Copy link
Contributor

@aguscha333 aguscha333 commented Aug 20, 2018

OauthReceiver allow custom fetch function

This PR fixes #28. It contains an enhancement to the OauthReceiver component. The aim is to allow the use of a custom fetch function since the one being used had some restrictions.

Added tokenFn as an optional prop to the OauthReceiver. As it says in the new documentation it should be a Promise, if it's a function then it will be used as fetch, if not it will fall back to the fetch2 function that was originally being used.

The tokenFn receives the same props as fetch2. I don't think that fetchTokenArgs is needed in this case since tokenFn will probably already have the correct configuration for the project. I kept it just in case someone needs it.

Documentation was edited to include this new enhancement and tests were added as well.

All tests are passing and I tested it in my own project and is working as well.

I am not an expert when writing tests so I'd appreciate any feedback on those and on the other changes as well.

If there is anything else I need to do in order to get this approved please let me know.

@adambrgmn
Copy link
Owner

Hi, @aguscha333,
Sorry I haven't responded yet. But I have a very busy work week right now. But I'll look into this in the beginning of next week!

@aguscha333
Copy link
Contributor Author

hi @adambrgmn,
Sure! no worries 😄.

@adambrgmn
Copy link
Owner

@aguscha333 , great work! I like the implementation and it works fine for me as well! I'll merge this :)

@adambrgmn adambrgmn merged commit 4e398fb into adambrgmn:master Aug 29, 2018
@adambrgmn
Copy link
Owner

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for custom fetch function in OauthReceiver
2 participants