Skip to content
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

[Feature]: authWithOAuth2 support AbortSignal #265

Open
shynome opened this issue Dec 19, 2023 · 5 comments
Open

[Feature]: authWithOAuth2 support AbortSignal #265

shynome opened this issue Dec 19, 2023 · 5 comments

Comments

@shynome
Copy link

shynome commented Dec 19, 2023

No description provided.

@ganigeorgiev
Copy link
Member

Please don't open issues without description. Could you elaborate what is your use case?

@ganigeorgiev
Copy link
Member

ganigeorgiev commented Dec 19, 2023

If you are trying to cancel a pending authWithOAuth2() call I guess we can introduce a requestKey support similar to the other SDK methods, which will allow cancelling with pb.cancelRequest(requestKey).

The problem with the "all-in-one" authWithOAuth2() call is that it performs 3 different requests - listAuthMethods, start a realtime subscription and finally call to the authWithOAuth2Code() method. It is doable but requires some more thinking to structure it properly.

@shynome
Copy link
Author

shynome commented Dec 19, 2023

I have found requestKey, but I feel it is not a good interface for javascript, I like use js native cancel signal AbortSignal more

That’s a bit of a digression, now typescript support using, we can refactor cleanup code.
I would love to contribute, but my code format is diffrent with you, maybe upload .editorconfig file is good idea

@ganigeorgiev
Copy link
Member

ganigeorgiev commented Dec 19, 2023

Under the hood the builtin request cancellation is managed via AbortController instances.
There are no plans for now to pass AbortController/AbortController.signal as argument because it will be inconsistent with the other APIs and the internal implementation may change in the future.

As mentioned earlier, I'll consider supporting passing requestKey to the "all-in-one" authWithOAuth2() method but I'll have to think a little more on it and for now remains a low priority.

@shynome
Copy link
Author

shynome commented Dec 19, 2023

Thanks for your reply, I had implement it by myself, so it will not block me.

requestKey is fine, but it need export cancelRequestKey function, let user can muanal control cancel it

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

No branches or pull requests

2 participants