This sample project demonstrates how a registered app can request authorization from Uphold users to perform actions on their behalf, by using the authorization code OAuth flow. For further background, please refer to the API documentation.
This flow is recommended for web applications that wish to retrieve information about a user’s Uphold account, or take actions on their behalf.
This process, sometimes called “3-legged OAuth”, requires three steps, each initiated by one of the three actors:
This example sets up a local server that can be used to perform the OAuth web application flow cycle as described above.
To run this example, you must have:
npm install
(or yarn install
)https://localhost:3000/callback
(you may use a different port number, if you prefer).
Note that this demo expects at least the user:read
scope to be activated..env
file based on the .env.example
file, and populate it with the required data.
Make sure to also update the SERVER_PORT
if you changed it in the previous step.node index.js
chrome://flags/#allow-insecure-localhost
in Chromium-based browsers,
to toggle support for self-signed localhost certificates.Once the authorization is complete and an access token is obtained, the local server will use it to make a test request to the Uphold API. The output will be printed in the command line.