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

Support For DI #46

Closed
granthoff1107 opened this issue Nov 30, 2018 · 8 comments
Closed

Support For DI #46

granthoff1107 opened this issue Nov 30, 2018 · 8 comments

Comments

@granthoff1107
Copy link
Contributor

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.

@granthoff1107
Copy link
Contributor Author

Additionally, Notification should only be support by the API client, because there is no way to validate the signature from OAuth

@bchavez
Copy link
Owner

bchavez commented Nov 30, 2018

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

@granthoff1107
Copy link
Contributor Author

granthoff1107 commented Nov 30, 2018 via email

@bchavez
Copy link
Owner

bchavez commented Nov 30, 2018

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

@granthoff1107
Copy link
Contributor Author

granthoff1107 commented Nov 30, 2018 via email

@granthoff1107
Copy link
Contributor Author

Hmm even with the Notifications scope on I'm still getting a 403 have you tested notifications with OAuth against coinbase?

@granthoff1107
Copy link
Contributor Author

I got have the error code now, It's not allowed: "This endpoint is only available for API key authentication"

@bchavez
Copy link
Owner

bchavez commented Dec 3, 2018

DI interfaces been added in #47. Closing this.

@bchavez bchavez closed this as completed Dec 3, 2018
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