GithubHelp home page GithubHelp logo

Comments (3)

tarricsookdeo avatar tarricsookdeo commented on June 8, 2024 1

Hi @ajithK24!

It seems like you are trying to access the token endpoint to create a new access token. The correct syntax for that is:

const Client = require('dwolla-v2').Client;

// instantiate client
const dwolla = new Client({
  environment: 'sandbox',
  key: <KEY>,
  secret: <SECRET>
});

// Request to token endpoint
dwolla.auth
  .client()
  .then(res => console.log(res))

/*A token object should be console logged
Token {
  client: Client {
    key: <KEY>,
    id: <ID>,
    secret: <SECRET>,
    environment: 'sandbox',
    onGrant: undefined,
    authUrl: 'https://accounts-sandbox.dwolla.com/auth',
    tokenUrl: 'https://api-sandbox.dwolla.com/token',
    apiUrl: 'https://api-sandbox.dwolla.com',
    auth: [Function: methods] {
      client: [Function: bound requestToken],
      refresh: [Function: bound refreshGrant]
    },
    Auth: [Function: bound AuthClass],
    Token: [Function: bound Token],
    get: [Function (anonymous)],
    post: [Function (anonymous)],
    delete: [Function (anonymous)],
    refreshToken: [Function (anonymous)],
    token: [Function (anonymous)]
  },
  access_token: <ACCESS TOKEN>,
  refresh_token: undefined,
  expires_in: 3448,
  scope: undefined,
  account_id: undefined
}
*/

However, our Node SDK takes care of token management for you. You can simply make requests against the client using the low level methods .get, .post, and .delete. The SDK will check if you have a valid token, and if not request a new one automatically.

Also, our Node SDK is a server side-library and shouldn't be accessed via a web browser. Try making requests via Postman, CURL, or another type of server-side client. You can read up more about this issue here: https://discuss.dwolla.com/t/dwolla-post-giving-me-a-cors-error/7652/3?u=spencer.

from dwolla-v2-node.

ajithK24 avatar ajithK24 commented on June 8, 2024

Hi @ajithK24!

It seems like you are trying to access the token endpoint to create a new access token. The correct syntax for that is:

const Client = require('dwolla-v2').Client;

// instantiate client
const dwolla = new Client({
  environment: 'sandbox',
  key: <KEY>,
  secret: <SECRET>
});

// Request to token endpoint
dwolla.auth
  .client()
  .then(res => console.log(res))

/*A token object should be console logged
Token {
  client: Client {
    key: <KEY>,
    id: <ID>,
    secret: <SECRET>,
    environment: 'sandbox',
    onGrant: undefined,
    authUrl: 'https://accounts-sandbox.dwolla.com/auth',
    tokenUrl: 'https://api-sandbox.dwolla.com/token',
    apiUrl: 'https://api-sandbox.dwolla.com',
    auth: [Function: methods] {
      client: [Function: bound requestToken],
      refresh: [Function: bound refreshGrant]
    },
    Auth: [Function: bound AuthClass],
    Token: [Function: bound Token],
    get: [Function (anonymous)],
    post: [Function (anonymous)],
    delete: [Function (anonymous)],
    refreshToken: [Function (anonymous)],
    token: [Function (anonymous)]
  },
  access_token: <ACCESS TOKEN>,
  refresh_token: undefined,
  expires_in: 3448,
  scope: undefined,
  account_id: undefined
}
*/

However, our Node SDK takes care of token management for you. You can simply make requests against the client using the low level methods .get, .post, and .delete. The SDK will check if you have a valid token, and if not request a new one automatically.

Also, our Node SDK is a server side-library and shouldn't be accessed via a web browser. Try making requests via Postman, CURL, or another type of server-side client. You can read up more about this issue here: https://discuss.dwolla.com/t/dwolla-post-giving-me-a-cors-error/7652/3?u=spencer.

Ok @tarricsookdeo instead of node can we able to use JAVA ?

from dwolla-v2-node.

tarricsookdeo avatar tarricsookdeo commented on June 8, 2024

@ajithK24 Yes, you are able to use Java to access Dwolla's API. We also have a Kotlin SDK that makes it easy to interact with the API using Java. Here is a link to it: https://github.com/Dwolla/dwolla-v2-kotlin

from dwolla-v2-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.