Integration

Summary

Debank Connect is based on the OAuth2.0 authorization standard protocol. With DeBank Connect, enable Web3 users to effortlessly sign in your Dapp via DeBank. Once they grant authorization, access their account name/avatar, on-chain portfolio data, and social following data.

Create App

Create and Verify App

Log in to Official dashboard, click the Apps tab on the navbar, and click Create New App.

Once you have finished creating the App, follow the instructions to complete the validation of the App.

Create Client

Click "Create Client"

After the creation, save the Client ID and Client Secret for subsequent Integration.

Integration

DeBank Connect currently only supports OAuth 2.0 Authorization Code Grant.

OAuth 2.0 Authorization Code Grant

  1. The DAPP guides the user to the DeBank Connect authorization page

Example of Authorization Redirect URL:

https://debank.com/connect?client_id=7iySAAu5k9zJdpu3NbSyvb6p&response_type=code&scope=user:base:read%20user:chain:read%20user:social:read&redirect_uri=https://example-dapp.com/callback&state=44438279
  • Description of DeBank Connect Authorization Page URL Parameters

  1. The user can decide whether to authorize the Web service application. If authorization is not agreed, the process terminates. If authorization is agreed, the authorization endpoint is triggered. Then redirect to the "redirect_uri"

Example of redirect uri:

https://example-dapp.com?code=Ro6MIQFigLDcK1hceX9B9B8dgl2ZgcStHXsDQ2XugM0v1gh3&state=132141234

  1. The dApp server side obtains access token and refresh token through authorization code.

DeBankConnect API for access token and refresh_token.

URL: https://api.connect.debank.com/oauth/token
Method:POST
Head:auth = HTTPBasicAuth(client_id, client_secret)
Content-Type:form-data
HTTPBasicAuth: https://en.wikipedia.org/wiki/Basic_access_authentication

Response:

Example:

curl --location -g --request POST 'http://api.connect.debank.com/oauth/token' \
--header 'Authorization: Basic TVM4YUxDemZQTlZDTURiemFHZlZpcUlaOm9iWDJJbFRjdW1XS0U0T1lEYm51RzBGU003Z09wb1I3UFlFUFdlazhJeHJBazlBaQ==' \
--form 'grant_type="authorization_code"' \
--form 'code="<code>"' \
--form 'redirect_uri="<redirect_uri>"'

{
    "access_token": "xmpF421TrBTyBTwYNLAQXE3wTKgqt5h29HaKfGZPJh",
    "expires_in": 864001,
    "refresh_token": "agCd2oYdCrLiqKCJNrOFQmkPg6b7N0OQcPXXw7Pf6vQHNDR2",
    "scope": [
        "user:base:read",
        "user:chain:read",
        "user:social:read"
    ],
    "token_type": "Bearer"
}
  1. The DAPP service refreshes the access_token by refresh_token.

URL: api.connect.debank.com/oauth/token
Method:POST
Headers:auth = HTTPBasicAuth(client_id, cleint_secret)
Content-Type:form-data

Response:

Example:

curl --location -g --request POST 'http://api.connect.debank.com/oauth/token' \
--header 'Authorization: Basic UzNNQVdWa1NKZ2FpNHFLVGZPZnR4bEdtOlMwSlI0QThCRUw4T2FENWNjU2xMcVh3TmQzUzJzNFVZVWRSM0VxNkEzczJJZnZTMA==' \
--form 'grant_type="refresh_token"' \
--form 'refresh_token="<refresh_token>"'

{
    "access_token": "xmpF421TrBTyBTwYNLAQXE3wTKgqt5h29HaKfGZPJh",
    "expires_in": 864001,
    "refresh_token": "agCd2oYdCrLiqKCJNrOFQmkPg6b7N0OQcPXXw7Pf6vQHNDR2",
    "scope": [
        "user:base:read",
        "user:chain:read",
        "user:social:read"
    ],
    "token_type": "Bearer"
}

Accessible API list

Last updated