Error after generating a token in a js chrome extension and then trying to verify it on a backend nodejs server #706
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: question
Request for information or clarification. Not an issue.
I am trying to generate a token in a chrome extension and then use it to verify requests to the backend server. I have been successful at generating a token in the front end but when I send it to the backend and verify it with this library but always get the error
Error: Wrong number of segments in token: [TOKEN_HERE]
.I have tried to find out how to fix it online and nothing that I have found works. The ID of my extension is the same as the ID in the console.
I created a chrome extension application in the developer console and added this to my manifest:
Once I ran the code
It generates a token that I was able to validate in the extension with:
This also generated a new oAuth2 client in my console that is a web application:
On the backend nodejs server I tried using both of the generated IDs to verify the token. The extension application doesn't have a client secret but the webapp does. I have tried using the secret with the webserver id but this didn't work either.
This the code for the backend verification:
I want to verify the token with this code but it is unable to do so. Every time I use the token that is verifiable with the
xhr
request it just gives me the errorError: Wrong number of segments in token
. I have no clue where to go from here as documentation is a bit scarce. All help is appreciated!EDIT: I have also tried to validate the token with the
Bearer
prefix it didn't work.The text was updated successfully, but these errors were encountered: