Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateAccessToken #7

Open
hanstf opened this issue Jun 14, 2019 · 9 comments
Open

generateAccessToken #7

hanstf opened this issue Jun 14, 2019 · 9 comments

Comments

@hanstf
Copy link

hanstf commented Jun 14, 2019

Hi, do you know whether can I generateAccessToken with my seller user name and password ?

@Wizard-Rogue
Copy link

No. generateAccessToken accepts code as a parameter. You can get code after authorizing your app through the Lazada Open Platform Authorization page.

@hanstf
Copy link
Author

hanstf commented Jun 14, 2019

Thats sad, so they only have an implicit grant method ? Because I am a seller and wanted to do a server to server integration.

@Wizard-Rogue
Copy link

Wizard-Rogue commented Jun 14, 2019 via email

@sankar9659
Copy link

sankar9659 commented May 8, 2020

Cannot generate access token with this package.
My code is

const authCode = '0_118985_zUFFF5x0Wal7NNNRKPQFVjSZ2236' // replace valid authCode here
const params = {
code: authCode
}
const response = aLazadaAPI
.generateAccessToken(params)
.then(response => console.log(JSON.stringify(response, null, 4)))
.catch(error => console.log(JSON.stringify(error, null, 4)))

getting this error
"type": "ISV",
"code": "IncompleteSignature",
"message": "The request signature does not conform to lazada standards",
"request_id": "0b86d3f015889470213992399"

Wizard-Rogue please help

@sankar9659
Copy link

@Wizard-Rogue please reply to my answer

@conradlo
Copy link
Contributor

Hi, are you looking at the examples/generateAccessToken.js ?
Beware of the input params:

  1. appKey
  2. appSecret
  3. countryCode
  4. authCode

If any one of them had some issues, Lazada will not give you a token back.

const aLazadaAPI = new LazadaAPI('app_key', 'app_secret', 'country_code')

const authCode = 'auth_code' // replace valid authCode here
const params = {
  code: authCode,
}

Example errors:

IncompleteSignature Error

Something is wrong about the appSecret

{
    "type": "ISV",
    "code": "IncompleteSignature",
    "message": "The request signature does not conform to lazada standards",
    "request_id": "..."
}

InvalidCode Error

When authCode is expired.

{
    "code": "InvalidCode",
    "type": "ISP",
    "message": "Invalid authorization code",
    "request_id": "..."
}

InvalidAppKey Error

when appKey does not exist.

{
    "type": "ISV",
    "code": "InvalidAppKey",
    "message": "The specified App Key is invalid",
    "request_id": "..."
}

flow runtime error

Something is wrong about the countryCode

/[path]/lazada-open-platform-sdk/node_modules/flow-runtime/dist/flow-runtime.js:714
        throw error;
        ^

TypeError [RuntimeTypeError]: countryCode must be one of: "SINGAPORE" | "THAILAND" | "MALAYSIA" | "VIETNAM" | "PHILIPPINES" | "INDONESIA"

Expected: "SINGAPORE" | "THAILAND" | "MALAYSIA" | "VIETNAM" | "PHILIPPINES" | "INDONESIA"

Actual Value: "SINGAPOR"

Actual Type: string

    at new exports (/[path]/lazada-open-platform-sdk/lib/index.js:54:64)
    at Object.<anonymous> (/[path]/lazada-open-platform-sdk/examples/generateAccessToken.js:23:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  errors: [
    [
      [],
      'must be one of: "SINGAPORE" | "THAILAND" | "MALAYSIA" | "VIETNAM" | "PHILIPPINES" | "INDONESIA"',
      [UnionType]
    ]
  ]
}

@sarcastic-verma
Copy link

Hey @hanstf , did you figure out a way to generate code from code bypassing the oauth panel?

@basic-code-info
Copy link

Hi @hanstf did you find solution?

@maithanhtoan1289
Copy link

how to get authcode.
I need help getting order information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants