How do I get a Coinbase current user's info via API calls using OAuth2 and PHP? -
I have established a site that can successfully access the token and hold account balancing, for example, PHP library
Now I'm a little stuck; It is not clear to me how to run different API calls available for Symbasebase, I am sure I can understand it at the end, but I want to make sure that I am not ignoring some functionality which is already coinbase PHP is built in library
My impression is that I need PHP to authenticate JSON request for CNbbase Need to eat, or am I missing an example in the PHP library?
For example, after authorizing the app, I want to display the authenticated user's name on my site. I do not see an underlying function for this in PHP Library, so I think I need to use the call.
Does anyone give me an example of how this is actually done?
Thanks to Robin on Coinbase support, I got an answer. Here's an example of how to get some user details in PHP via the Coinbase OAUTH2 API.
In this example, these functions are added to Coinsbase-PHP / Lib / Coinbase.php, inside the Sybbase class:
class Coinbase {/ ... ... function here * / / * new content ... * / public function getUserID () {return $ this- & gt; Receive ("user", array ()) - & gt; User [0] - & gt; User- & gt; Id ; } Public function getUserName () {return $ the-> ("user", array ()) - & gt; User [0] - & gt; User- & gt; Name; } Public function getUserEmail () {return $ the-> ("user", array ()) - & gt; User [0] - & gt; User- & gt; E-mail; } Public function getUserTimeZone () {$ $ this- & gt; Receive ("user", array ()) - & gt; User [0] - & gt; User- & gt; Time_jone; } Public Function getUserNativeCurrency () {Return $ this- & gt; Receive ("user", array ()) - & gt; User [0] - & gt; User- & gt; Country_ currency; } "User" matches the full API address call: "GET" P> Users API response is something weird because it is designed to return many users through an array, even if it is defined as returning the "current user" information Has been done This is the reason why we need to add "[0]" to the object for each of these functions.
Comments
Post a Comment