-
Notifications
You must be signed in to change notification settings - Fork 109
Add getOAuthApi method #117
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
base: main
Are you sure you want to change the base?
Conversation
…e of a fetch call
|
|
@mattzcarey - Can you give this a review? @kentonv - Found a neat way to add methods to the provider without exposing them over RPC |
|
@kentonv Updated with requested changes. |
This PR makes OAuthHelpers available outside of the
fetchmethod (i.e. in a worker's RPC methods) via thegetOAuthApifunction.Problem
this.env.OAUTH_PROVIDERgets populated inOAuthProviderImpl.fetch(), so if we try to use it in a worker's RPC methods, for example, it will always be undefined.Solution
We add a method
getOAuthApi(options: OAuthProviderOptions, env: any)that initializes and retrieves OAuthHelpers directly.