You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I apologize for bringing to the table a topic that has already been discussed, but I think the problem was not well understood.
When creating a Provider it is possible to configure a custom http.Client by sending it within the context.
It is saved in the Provider.client attribute, however, it is never used from there and it is necessary to set it again in the context every time we invoke a method of the provider that needs it.
I understand the clarifications that were made in other comments, for example: "The clients and options are passed through contexts to match Go's OAuth 2.0 package" (#402) and I agree that the current context must be sent to each of the methods that need it because it could be different from the context that was used to create the provider; but Go's OAuth 2.0 package does not have a "client" attribute for its config and the requests finally go out from internal and public functions, not methods, therefore they do not have a global configuration.
It doesn't seem correct to have to configure the http.Client again when it was already done when creating the provider and it is saved in an attribute of it, being available from there for all provider methods that have to make a request.
I think that the global configurations of the provider could be used in each of its methods, this would work as a helper to make the client's work simpler and more transparent, for example:
I apologize for bringing to the table a topic that has already been discussed, but I think the problem was not well understood.
When creating a Provider it is possible to configure a custom http.Client by sending it within the context.
It is saved in the Provider.client attribute, however, it is never used from there and it is necessary to set it again in the context every time we invoke a method of the provider that needs it.
I understand the clarifications that were made in other comments, for example: "The clients and options are passed through contexts to match Go's OAuth 2.0 package" (#402) and I agree that the current context must be sent to each of the methods that need it because it could be different from the context that was used to create the provider; but Go's OAuth 2.0 package does not have a "client" attribute for its config and the requests finally go out from internal and public functions, not methods, therefore they do not have a global configuration.
It doesn't seem correct to have to configure the http.Client again when it was already done when creating the provider and it is saved in an attribute of it, being available from there for all provider methods that have to make a request.
I think that the global configurations of the provider could be used in each of its methods, this would work as a helper to make the client's work simpler and more transparent, for example:
func (p *Provider) UserInfo(ctx context.Context, tokenSource oauth2.TokenSource) (*UserInfo, error) {
//...
}
Thanks!
The text was updated successfully, but these errors were encountered: