bchavez / Coinbase

:moneybag: A .NET/C# implementation of the Coinbase API.
https://developers.coinbase.com/api/v2
MIT License
170 stars 92 forks source link

OAuth Auth Refresh Tokens #40

Closed granthoff1107 closed 5 years ago

granthoff1107 commented 5 years ago

I'll create a pull request for this this weekend, but lets discuss the specs, Basically when a token expired 2 things should happen.

1. The Token internally refresh and replays the last request.
2. We need a call back or an external event so the user can update their user information appropriately.

Specs:

When a user's token expires the server will return 401 Error with an id  expired_token, 
Send a request to the Coinbase OAuthEndpoint 

    POST https://api.coinbase.com/oauth/token
    Body: {
         refresh_token  : "34t703948twdfuhgsdofigheiosfghsoidhgier"
         grant_type: "refresh_token"
    }

The Server will response:

"access_token": "regjworigjwoerigjpworegjodspfjgospfijgweoprijg", "token_type": "bearer", "expires_in": 7200, "refresh_token": "lkdfgadlkgheaklrherthiuhidsuhidfuh", "scope": "wallet:accounts:read wallet:addresses:read", "created_at": 1541870695

bchavez commented 5 years ago

This should be done now with the latest beta.

https://www.nuget.org/packages/Coinbase/5.0.0-beta-5

See docs for details: https://github.com/bchavez/Coinbase#authentication-details

Thanks again Grant for the help!

-Brian

granthoff1107 commented 5 years ago

Any luck on merging the latest pull request for refresh tokens?

On Mon, Nov 19, 2018 at 5:06 PM Brian Chavez notifications@github.com wrote:

This should be done now with the latest beta.

https://www.nuget.org/packages/Coinbase/5.0.0-beta-5

See docs for details: https://github.com/bchavez/Coinbase#authentication-details

Thanks again Grant for the help!

-Brian

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bchavez/Coinbase/issues/40#issuecomment-440058798, or mute the thread https://github.com/notifications/unsubscribe-auth/AMsMnb4faotPrAjksRv80srEeyYcyKENks5uwytVgaJpZM4Ye-SR .

bchavez commented 5 years ago

Hey Grant,

I should be able to review it soon. I'm a little backed up right now. I'm going to try aim for tonight.

granthoff1107 commented 5 years ago

Thanks I tried to keep the change set to a minimum to make it easier

On Tue, Nov 20, 2018 at 7:22 PM Brian Chavez notifications@github.com wrote:

Hey Grant,

I should be able to review it soon. I'm a little backed up right now. I'm going to try aim for tonight.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bchavez/Coinbase/issues/40#issuecomment-440478924, or mute the thread https://github.com/notifications/unsubscribe-auth/AMsMnccnkh1Cf6UVGHfhcZewDqlkdrSPks5uxJy3gaJpZM4Ye-SR .

bchavez commented 5 years ago

Definitely, thanks for keeping changes as minimal as possible. Smaller changes help a lot when reviewing. :)


Brian Chavez

Bit Armory, Inc.

http://www.bitarmory.com

From: granthoff1107 [mailto:notifications@github.com] Sent: Tuesday, November 20, 2018 4:24 PM To: bchavez/Coinbase Cc: Brian Chavez; State change Subject: Re: [bchavez/Coinbase] OAuth Auth Refresh Tokens (#40)

Thanks I tried to keep the change set to a minimum to make it easier

On Tue, Nov 20, 2018 at 7:22 PM Brian Chavez notifications@github.com wrote:

Hey Grant,

I should be able to review it soon. I'm a little backed up right now. I'm going to try aim for tonight.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bchavez/Coinbase/issues/40#issuecomment-440478924, or mute the thread https://github.com/notifications/unsubscribe-auth/AMsMnccnkh1Cf6UVGHfhcZewDqlkdrSPks5uxJy3gaJpZM4Ye-SR .

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bchavez/Coinbase/issues/40#issuecomment-440479212 , or mute the thread https://github.com/notifications/unsubscribe-auth/AAdLpq_qmcIkejgi_g4nnwLRvnFkASQ3ks5uxJ0MgaJpZM4Ye-SR . https://github.com/notifications/beacon/AAdLpm3Mtz7SCNhlIhcwpFw-AalphdxTks5uxJ0MgaJpZM4Ye-SR.gif