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
644
votes
35 answers

Parse (split) a string in C++ using string delimiter (standard C++)

I am parsing a string in C++ using the following: using namespace std; string parsed,input="text to be parsed"; stringstream input_stringstream(input); if (getline(input_stringstream,parsed,' ')) { // do some processing. } Parsing with a…
TheCrazyProgrammer
  • 7,918
  • 8
  • 25
  • 41
565
votes
8 answers

What is token-based authentication?

I want to understand what token-based authentication means. I searched the internet but couldn't find anything understandable.
csharpbaby
  • 6,125
  • 3
  • 18
  • 12
309
votes
18 answers

Sending the bearer token with axios

In my react app i am using axios to perform the REST api requests. But it's unable to send the Authorization header with the request. Here is my code: tokenPayload() { let config = { headers: { 'Authorization': 'Bearer ' + validToken() …
rakibtg
  • 5,521
  • 11
  • 50
  • 73
243
votes
25 answers

Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead

I was using a username password for pushing my code. It was working for several months, but suddenly I'm not able to do it and am getting this error: Username for 'https://github.com': shreyas-jadhav Password for…
Shreyas Jadhav
  • 2,363
  • 4
  • 10
  • 23
234
votes
4 answers

What's the difference between JWTs and Bearer Token?

I'm learning something about Authorization like Basic, Digest, OAuth2.0, JWTs, and Bearer Token. Now I have a question. You know the JWTs is being used as an Access_Token in the OAuth2.0 standard. JWTs appears at RFC 7519, and Bearer Token is at RFC…
laoqiren
  • 3,457
  • 5
  • 19
  • 29
202
votes
3 answers

Do login forms need tokens against CSRF attacks?

From what I've learned so far, the purpose of tokens is to prevent an attacker from forging a form submission. For example, if a website had a form that input added items to your shopping cart, and an attacker could spam your shopping cart with…
php_learner
  • 2,029
  • 2
  • 13
  • 3
178
votes
3 answers

How can I concatenate twice with the C preprocessor and expand a macro as in "arg ## _ ## MACRO"?

I am trying to write a program where the names of some functions are dependent on the value of a certain macro variable with a macro like this: #define VARIABLE 3 #define NAME(fun) fun ## _ ## VARIABLE int NAME(some_function)(int…
JJ.
  • 1,781
  • 2
  • 11
  • 3
172
votes
4 answers

Authenticating socket io connections using JWT

How can I authenticate a socket.io connection? My application uses a login endpoint from another server (python) to get a token, how can I get use that token whenever a user opens a socket connection on the node side? io.on('connection',…
el_pup_le
  • 11,711
  • 26
  • 85
  • 142
163
votes
11 answers

Do Google refresh tokens expire?

I have used the refresh token several times in just a short period for testing purposes, but I wonder whether Google refresh tokens ever expire? Can I use the same refresh token to get another access token again and again for a long period (a week…
Robin Carlo Catacutan
  • 13,249
  • 11
  • 52
  • 85
154
votes
9 answers

Python requests library how to pass Authorization header with single token

I have a request URI and a token. If I use: curl -s "" -H "Authorization: TOK:" etc., I get a 200 and view the corresponding JSON data. So, I installed requests and when I attempt to access this resource I get a 403 probably…
user1552586
148
votes
5 answers

How to securely store access token and secret in Android?

I am going to use oAuth to fetch mails and contacts from google. I don't want to ask the user each time to log in to obtain an access token and secret. From what I understood, I need to store them with my application either in a database or…
yeahman
  • 2,737
  • 4
  • 21
  • 25
133
votes
16 answers

How does strtok() split the string into tokens in C?

Please explain to me the working of strtok() function. The manual says it breaks the string into tokens. I am unable to understand from the manual what it actually does. I added watches on str and *pch to check its working when the first while loop…
user379888
127
votes
3 answers

Creating C macro with ## and __LINE__ (token concatenation with positioning macro)

I want to create a C macro that creates a function with a name based on the line number. I thought I could do something like (the real function would have statements within the braces): #define UNIQUE static void Unique_##__LINE__(void) {} Which I…
DD.
  • 1,273
  • 2
  • 9
  • 4
124
votes
5 answers

Best practices for server-side handling of JWT tokens

(spawned from this thread since this is really a question of its own and not specific to NodeJS etc) I'm implementing a REST API server with authentication, and I have successfully implemented JWT token handling so that a user can login through a…
JHH
  • 8,567
  • 8
  • 47
  • 91
121
votes
6 answers

Where to store the refresh token on the Client?

My SPA application uses the following architecture (source): This assumes that my client application knows about the refresh token, because I need it to request a new access token if no user credentials (e.g. email/password) are present. My…
Robin Wieruch
  • 14,900
  • 10
  • 82
  • 107
1
2 3
99 100