-
Notifications
You must be signed in to change notification settings - Fork 47
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
Token returned from getOAuthToken is unusable #112
Comments
Hi @louis030195, Are you still experiencing this issue? |
I've lost a bit track of it now, I have an implementation that works but not sure how. Basically renew the token every time the user has his crown ON My biggest problem now is that I cannot find a way to login multiple users and listen to multiple users brain in the same process, is there an example of doing so somewhere with oauth? the pseudo code look like this: // ...
for each user
const neurosity = new Neurosity();
await neurosity.logout(); // tried with or without
const token: string = await neurosity.getOAuthToken({
clientId: process.env.NEUROSITY_OAUTH_CLIENT_ID!,
clientSecret: process.env.NEUROSITY_OAUTH_CLIENT_SECRET!,
userId: userId,
});
if (!token) {
console.error("Failed to obtain token for userId:", userId);
return;
}
console.log("Obtained token for userId:", userId);
await neurosity.login({ customToken: token })
// here: Error logging in: Already logged in.
// ... Is there some kind of state in the file system? I was expecting that creating a Any feedback appreciated @alexcastillo 🙏 |
Are you running the code above in node or the browser? |
@alexcastillo node |
soo ... i found a solution i run each "brain listening" in different processes using this is not ideal but it works PS: noticed neurosity-sdk-js/src/api/index.ts Line 157 in 68a33cf
and neurosity-sdk-js/src/api/index.ts Line 71 in 68a33cf
tried to set the user to null or such hack, didn't solve my problem, went for the multi process solution |
My users connect their Neurosity account by going to an url created with:
OAuth tokens expire after 60 minutes, so I renew them with
getOAuthToken
.When I try to use the token from
getOAuthToken
it fails:If I use the first token it works. Seems to be an unexpected behaviour? What is the usage of the new token?
The text was updated successfully, but these errors were encountered: