Questions tagged [token]

A token is a string of characters, categorized according to the rules as a symbol (e.g., IDENTIFIER, NUMBER, COMMA). The process of forming tokens from an input stream of characters is called tokenization, and the lexer categorizes them according to a symbol type. A token can look like anything that is useful for processing an input text stream or text file.

A token is the smallest part of an input text with a meaning. A token may be a single character, a symbol, a word or anything that is useful for processing an input text. Tokens are used in processing programming languages or natural languages.

The process of forming tokens from an input stream is called tokenization or lexical analysis. A program or function which performs lexical analysis is called a lexical analyzer, lexer, or scanner.

7573 questions
121
votes
2 answers

What's the meaning of the "kid" claim in a JWT token?

I generated a JWT and there are some claims which I understand well, but there is a claim called kid in header. Does anyone know what it means? I generated the token using auth0.com
tylkonachwile
  • 2,025
  • 4
  • 16
  • 28
112
votes
14 answers

What is the difference between a token and a lexeme?

In Compiler Construction by Aho Ullman and Sethi, it is given that the input string of characters of the source program are divided into sequence of characters that have a logical meaning, and are known as tokens and lexemes are sequences that make…
user1707873
  • 1,307
  • 2
  • 10
  • 10
109
votes
9 answers

https URL with token parameter : how secure is it?

On our site, we provide to users a simulation based on their private information (given through a form). We would like to allow them to get back on their simulation results later, but without forcing them to create a login/password account. We have…
Flackou
  • 3,631
  • 4
  • 27
  • 24
101
votes
5 answers

best practice to generate random token for forgot password

I want to generate identifier for forgot password . I read i can do it by using timestamp with mt_rand(), but some people are saying that time stamp might not be unique every time. So i am bit of confused here. Can i do it with using time stamp…
keen
  • 3,001
  • 4
  • 34
  • 59
98
votes
2 answers

Access Lovoo API using Python

I am hoping to make use of the lovoo API, but don't really know how to start. After running Charles proxy and looking at the traffic, I have come to the following conclusion: First a GET to https://api.lovoo.com/oauth/requestToken? is sent as soon…
ChaChaPoly
  • 1,811
  • 5
  • 17
  • 39
97
votes
9 answers

Get refresh token google api

I can't get my refresh token with my code. I can only get my access token, token type etc., I have followed some tutorials like putting access_type=offline on my login URL: echo "
Robin Carlo Catacutan
  • 13,249
  • 11
  • 52
  • 85
93
votes
16 answers

syntax error: unexpected token <

I've tried many things and there's no way, always appears this error I tried to use only one option to see if passed, changed the call of jquery, but not. I looked in various places on the internet about this error, but could not solve or understand…
Geovane Krüger
  • 1,071
  • 1
  • 8
  • 10
92
votes
6 answers

How to handle 401 (Authentication Error) in axios and react?

I have one file request.js which contains wrapper for axios ajax request. I am calling request function from multiple react components and when one of the request fails I want to refresh the token and retry all the failed requests again. I can use…
Amir Saleem
  • 2,912
  • 3
  • 21
  • 35
92
votes
9 answers

JWT (JSON Web Token) library for Java

I am working on a web application developed using Java and AngularJS and chose to implement token authentication and authorization. For the exercise purpose, I've come to the point where I send the credentials to the server, generate a random token…
Marius Manastireanu
  • 2,461
  • 5
  • 19
  • 29
92
votes
3 answers

passport-local with node-jwt-simple

How can I combine passport-local to return a JWT token on successful authentication? I want to use node-jwt-simple and looking at passport.js I am not sure how to go about. var passport = require('passport') , LocalStrategy =…
cgiacomi
  • 4,629
  • 6
  • 27
  • 33
91
votes
5 answers

Generating cryptographically secure tokens

In order to generate a 32 character token for access to our API we currently use: $token = md5(uniqid(mt_rand(), true)); I have read that this method is not cryptographically secure as it's based on the system clock, and that…
fire
  • 21,383
  • 17
  • 79
  • 114
89
votes
1 answer

-bash: syntax error near unexpected token `newline'

To reset the admin password of SolusVM I am executing the following command: php /usr/local/solusvm/scripts/pass.php --type=admin --comm=change --username= When doing so, the following error message is printed: -bash: syntax error…
Jonathan.V
  • 918
  • 1
  • 7
  • 8
86
votes
4 answers

Is setting Roles in JWT a best practice?

I am considering to use JWT. In the jwt.io example I am seeing the following information in the payload data: "admin": true Admin can be considered as a Role, hence my question. Is setting the role in the token payload a habitual/good practice?…
ayorosmage
  • 1,607
  • 1
  • 15
  • 21
85
votes
5 answers

gitlab - Push to a repository using access_token

I implemented the oauth2 web flow in order to get access_token from users of my app. With the access_token, I would like to do the following actions: Get user informations Create a repo for this user Push code to this repo (using git push …
Simon Bruneaud
  • 2,263
  • 2
  • 12
  • 24
84
votes
5 answers

Best practices to invalidate JWT while changing passwords and logout in node.js?

I would like to know the best practices to invalidate JWT without hitting db while changing password/logout. I have the idea below to handle above 2 cases by hitting the user database. 1.Incase of password changes, I check for password(hashed)…
Gopinath Shiva
  • 3,822
  • 5
  • 25
  • 48