Support For DI
granthoff1107 opened this issue · comments
I know we briefly discussed this before, but I think we should reconsider support for DI. I have 3 projects I'm using the API and OAuth in. And I've found myself duplicating the class and interface definitions in each project. I'm tempted to move it into a shared assembly between the projects.
public interface ICoinbaseApiClient : ICoinbaseClient
{
}
public class CoinbaseApiClient: CoinbaseClient, ICoinbaseApiClient
{
public CoinbaseApiClient(ApiKeyConfig config): base(config)
{
}
}
public interface ICoinbaseOAuthClient : ICoinbaseClient
{
}
public class CoinbaseOAuthClient : CoinbaseClient, ICoinbaseOAuthClient
{
public CoinbaseOAuthClient(OAuthConfig config) : base(config)
{
}
}
I should have small pull request upcoming for notifications,
If you reconsider I'll add the support for DI,
let me know what you think.
Additionally, Notification should only be support by the API client, because there is no way to validate the signature from OAuth
Hi Grant,
Respectfully, I disagree about adding these interfaces and classes to explicitly support DI. However, that being said, you can send a PR to add them as long as there is no implementation details in any of these classes or any member declarations in these interfaces.
FWIW, webhook notification signature validation only applies to the WebhookHelper
static class and is not related to API key or OAuth.
Thanks,
Brian
Ah I see, pulling down notifications using OAuth should work.
Might want to double check and make sure you have a wallet:notifications:read
scope permission when the OAuth app gets authorized. IIRC, you can check your scopes by pinging: https://developers.coinbase.com/api/v2#show-authorization-information
Hmm even with the Notifications scope on I'm still getting a 403 have you tested notifications with OAuth against coinbase?
I got have the error code now, It's not allowed: "This endpoint is only available for API key authentication"
DI interfaces been added in #47. Closing this.