Emotiv / cortex-example

Example with Cortex V2/V3 API
https://emotiv.com
MIT License
194 stars 113 forks source link

Can't login on Cortex UI #180

Closed danifm1321 closed 2 years ago

danifm1321 commented 2 years ago

When I execute cortex_code_example.js I have the following error:

You must login on CortexUI before request for grant access then rerun

I'm using EMOTIV Launcher 3.3.0.26 on Ubuntu and I don't get any access request in the launcher. I have the TCP port 6868 listening and the user look like this:

  let user = {
      "clientId":clientId,
      "clientSecret":clientSecret,
      "debit":1
  }

with variables clientId and clientSecret with the pertinent values.

Any help? Did I misunderstand anything?

nguoithichkhampha commented 2 years ago

@danifm1321 , it say

You must login on CortexUI before request for grant access then rerun

did you login your emotiv id ?

danifm1321 commented 2 years ago

I logged in the launcher (I even set up a virtual device), if that's the answer to your question.

nguoithichkhampha commented 2 years ago

did you keep Emotiv Launcher running when you run the example code ? you should see a popup message from Emotiv Launcher ask for accept the request.

danifm1321 commented 2 years ago

Yes, Emotiv Launcher is running while I run

node cortex_code_example.js

in a terminal, and I don't get any popup in the launcher.

I am using this launcher, it is the correct one, right?

nguoithichkhampha commented 2 years ago

@danifm1321, can you log the value of accessGranted in the function checkGrantAccessAndQuerySessionInfo

danifm1321 commented 2 years ago

Instead of logging the value of accessGanted I logged the value of requestAccessResult and I got {"error":{"code":-32021,"message":"Invalid Client Credentials."},"id":1,"jsonrpc":"2.0"}.

So I hard coded clientId and clientSecret instead of getting them from files and it worked, although I checked the variables were getting the correct values.

Thank you for the support and sorry for the problems I've caused.