#Code: 'TokenInvalid'

46 messages · Page 1 of 1 (latest)

fickle estuary
#

I keep getting the code TokenInvalid ive reset my token and put it into my .env file and it still does not work.

#

oops forgot to press node.js category

wanton bison
#

do you load the env file into the process environment?

fickle estuary
wanton bison
#

well, you use dotenv, so yes, you do

#

what does your ..env file look like?

fickle estuary
wanton bison
#

firT console.log(process.env.token) logs the token?

#

(above the login call)

fickle estuary
#

like this?

wanton bison
#

aye

fickle estuary
#

when i do npm run test still the same error

wanton bison
#

does it print the token?

fickle estuary
#

nope

#

looks like it tried

wanton bison
#

then it didn't load the file

fickle estuary
#

oh.

#

How do i do that...

wanton bison
#

well, require("dotenv").config() should do that, provided you placed the .env file in the project root folder

fickle estuary
#

i placed it into functions\handlers

#

lemme take it in src folder

#

nvm the functions\handlers are in the src folder

wanton bison
#

the .env file is the relevant bit, should be in the project root, where your package json and stuff is

fickle estuary
wanton bison
#

.env file [...] where your package json [...] is

fickle estuary
wanton bison
#

try to log process.env instead

#

also move the dotenv config stuff to the top

#

right after the other requires

fickle estuary
wanton bison
#

there we go

fickle estuary
#

thank you for the help!

wanton bison
#

that was the secret bit, btw

fickle estuary
#

yeah thats why i didnt show the whole token...

wanton bison
#

doesn't matter, the first bit is the user id of the owner

fickle estuary
#

oh... ok

midnight sundialBOT
fickle estuary
#

now i know that

fickle estuary
wanton bison
#

that's more than enough firY

fickle estuary
#

Lol

wanton bison
#

everything up to the first dot isn't really a secret, everything after that is - is what it boils down to