51
            
            votes
        
        
            
        Am I generating email link tokens correctly?
                    If you are storing all the relevant information (token, expiration time, user) in the database anyway, the only thing you need to make sure about the token is that it is impossible to guess a token.
...
                
            
       
        
            
                49
            
            votes
        
        
            
            
        Should I be able to see patterns in a HS256 encoded JWT?
                    tl/dr: Your selected version of the JWT doesn't encrypt anything, it merely encodes it for easy
  transport.  The data in the payload is not meant to be a secret.
You have a JWS (JWT with signature).  ...
                
            
       
        
            
                35
            
            votes
        
        
        Determining Entropy in PHP
                    $token = md5($user_id . time());
The password reset token is supposed to be secret. However, it is derived from values that are not secret, or at least not hard to guess.
The attack scenario is as ...
                
            
       
        
            
                30
            
            votes
        
        
        Determining Entropy in PHP
                    Just a few additions to Sjoerd's answer:
It doesn't matter that the result is 128 bits long (you wrote 32 bits, but you probably meant hexadecimal characters). It's also irrelevant that MD5 cannot be ...
                
            
       
        
            
                29
            
            votes
        
        
            
            
        Why is 'Bearer' required before the token in 'Authorization' header in a HTTP request?
                    The word Bearer wants to provide the authentication scheme.
since there are Different Authentication Schemes provided with the Authorization header like:
Basic use for http-basic-Authentication
...
                
            
       
        
            
                27
            
            votes
        
            
                
                Accepted
            
        
            
            
        Should I be able to see patterns in a HS256 encoded JWT?
                    There's a bit of confusion of terminology here.
JWT defines the basic format of the claims, and some standard claims. It specifies that the JWT Claims Set should either be the payload of a JWS or a ...
                
            
       
        
            
                14
            
            votes
        
        
        Should I be able to see patterns in a HS256 encoded JWT?
                    What you're missing is that your token is signed (or, more precisely, authenticated with a symmetric key) but not encrypted.
If you take the token in your question above, split it into three pieces ...
                
            
       
        
            
                14
            
            votes
        
        
            
            
        Why do big sites use cookies and not OpenID connect?
                    Hmm. I think there's a lot you don't understand, here. Tons of sites do use OAuth (and often OIDC) for initial authentication, StackExchance (optionally) being one of them.
To answer the closest ...
                
            
       
        
            
                13
            
            votes
        
        
            
        Determining Entropy in PHP
                    In addition to the other good answers. From your question I also take away that you don't see why it's insecure since the attacker just gets "a scary looking 128-bit token that you an attacker ...
                
            
       
        
            
                11
            
            votes
        
        
            
            
        How to allow users to connect from multiple devices with refresh tokens?
                    I agree with Joe's answer 
  A possible solution is to add a device identification field in your database and issue a refresh token per device.
but I'd like to add some implementation details.
IMO ...
                
            
       
        
            
                8
            
            votes
        
            
                
                Accepted
            
        
            
        Does the TOTP Algorithm rely on the client time always being synced correctly?
                    Does the TOTP Algorithm rely on the client time always being synced correctly?
Yes
  What happens if for some reason a cell phones clock / calendar is off by a significant amount of time? Does the ...
                
            
       
        
            
                7
            
            votes
        
        
            
            
        Does the TOTP Algorithm rely on the client time always being synced correctly?
                    It is a common misconception that the TOTP algorithm is anyhow involved with Google or the other way round. TOTP is based on the HOTP algorithm, that was published in 2005 in RFC 4226.
The TOTP ...
                
            
       
        
            
                7
            
            votes
        
        
            
            
        Is an 8 characters long password reset token strong enough?
                    all the tokens had 8 characters, all alphabetes capital and small, no numbers or special characters
This is on the edge of acceptable.
It isn't easy to compromise an account this way. In an online ...
                
            
       
        
            
                7
            
            votes
        
        
            
        How does JTI prevent a JWT from being replayed?
                    Great question. I think the RFC text is a little confusing.
If the JWT is intercepted in some API call, this token can of course be used again and again (unless the application creates one-time-use ...
                
            
       
        
            
                7
            
            votes
        
        
            
        Secure HttpOnly Cookie or Header field for auth token securing an API?
                    I don't think there is a big difference in security between cookies or headers, if properly used.
Cookies are meant to maintain server state. So if you have a login call which starts a session, ...
                
            
       
        
            
                7
            
            votes
        
        
        How to securely store and use session IDs
                    Your second approach is the right one to take, with a few additional notes.
There's no need for a separate ID token. Just hash the session token and pass the hash digest to the DB (e.g. SELECT * FROM ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        How is security risk of storing authentication token in localStorage compared with cookies?
                    A cookie marked httpOnly, as the name implies, cannot be accessed from javascript.  So a 'conventional' web application using cookies is not vulnerable to naive XSS attacks if that flag is set (...
                
            
       
        
            
                5
            
            votes
        
        
            
        When to request refresh token? JWT
                    A few thoughts:
Cookies aren't a great place to put refresh tokens at all, really. They're not the worst, but it's more common to use Local Storage and only ever transmit them when you're using them. ...
                
            
       
        
            
                5
            
            votes
        
        
        Logging secrets in the user agent (browser)
                    I see no real problem with doing this in development environments. However, I am not sure I would do it in production for a number of reasons:
Why log stuff to the console in production at all? It ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Security doubts around the refresh token and how it works
                    You're mixing parts of the OAuth specification with implementation details and personal opinions from a user of a forum. This isn't very helpful when trying to understand the concepts of the OAuth ...
                
            
       
        
            
                4
            
            votes
        
        
        Token-based authentication - what's a good token length?
                    An update for those that find this question since it ranks highly on Google.
If appears from the current PHP documentation that openssl_random_pseudo_bytes can generate a cryptographically strong ...
                
            
       
        
            
                4
            
            votes
        
        
            
            
        Am I generating email link tokens correctly?
                    If you use this information for verification purposes only and are already storing this in the database, it would be sufficient to generate a random UUID and store it with the mata data you need (...
                
            
       
        
            
                4
            
            votes
        
        
            
        Github.com token authorisation since 13th August, impractical?
                    Standard git operations (push, pull, delete branch...) can be done using public key authentication. This is a more secure and convenient way to authenticate to GitHub (Just make sure that no one has ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
        Best login flow for username and password authentication
                    Authentication systems are complicated (honestly, too much so for a single question). Most web app frameworks include at least part of one in-box, and if you want to write your own, you're at ...
                
            
       
        
            
                4
            
            votes
        
        
            
            
        Does the absence of CSRF tokens need to be fixed as soon as possible?
                    You should evaluate the situation as soon as possible in order to see if you are at risk:
Do you expose mutations/actions as GET? (which is bad)
Do you expose mutations/actions using text/plain, ...
                
            
       
        
            
                4
            
            votes
        
            
                
                Accepted
            
        
            
            
        JWT-bearer grant with JWT assertion vs. client credentials grant with JWT client assertion?
                    Section 2.1 introduces JWT bearer tokens as a new authorization grant for OAuth 2.0. This grant can be used instead of the four standard grants (like the Authorization Code Grant or the Client ...
                
            
       
        
            
                3
            
            votes
        
        
            
            
        How to prevent refreshing a stolen access token
                    To get a new access token, the client needs to send the refresh token to the server. So if the attacker only steals the access token, she will not be able to refresh. To do that, she needs to steal ...
                
            
       
        
            
                3
            
            votes
        
        
        Understanding patch for my report
                    That is probably a UUID or GUID. It looks like this:
123e4567-e89b-12d3-a456-426655440000
              ^
There are several versions, indicated by the mark above. Version 4 is random. Version 1 and 2 ...
                
            
       
        
            
                3
            
            votes
        
        
        What is the point of having a refresh token if it can be as easily stolen as an access token on client-side/JavaScript applications (SPA/PWA)?
                    I believe Jari's answer says it all. I had the exact same question, and this answer really clarified it.
If you don't mind, I'd like to add an extra note for future readers from my personal notes:
...
                
            
       
        
            
                3
            
            votes
        
            
                
                Accepted
            
        
        What happens if a secure token is provided to a trusted party that gets compromised
                    There's not really enough information to determine the specifics here, but there are some general answers that can be provided.
In your scenario, the assumption by default should be that node A has ...
                
            
       
        Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
token × 224authentication × 92
jwt × 35
api × 21
oauth × 20
csrf × 14
session-management × 14
php × 13
encryption × 12
web-application × 12
hash × 12
rest × 12
cookies × 11
authorization × 10
oauth2 × 9
tls × 8
android × 8
javascript × 8
passwords × 7
random × 7
json × 7
cryptography × 5
mobile × 5
account-security × 5
rsa × 5