• 4 Posts
  • 10 Comments
Joined 3 years ago
cake
Cake day: June 6th, 2023

help-circle










  • Upon further reading of RFC 6749, it appears that OAuth does require this – sometimes.

    It depends on the OAuth Flow. In this case, Stripe uses the “Authorization Code” Grant.

    This is documented in Stripe’s OAuth reference documentation here:

    curl https://connect.stripe.com/oauth/token \
      -u sk_test_MgvkTWK1jRG3olSRx9B7Mmxo: \
      -d “code”=”ac_123456789” \
      -d “grant_type”=”authorization_code”
    

    Authorization Code Grants are defined in RFC 6749 (The OAuth 2.0 Authorization Framework), Section 4.1 (Authorization Code Grant):

    To better understand why the OAuth Authorization Code Grant requires sharing the access token with a thrid party server, I found this article (Common OAuth Vulnerabilities) by Doyensec very elucidating:

    It says that the Authorization Code Flow is supposed to be used when you don’t want to share the tokens with the user agent.

    The Authorization Code Flow is one of the most widely used OAuth flows in web applications. Unlike the Implicit Flow, which requests the Access Token directly to the Authorization Server, the Authorization Code Flow introduces an intermediary step. In this process, the User Agent first retrieves an Authorization Code, which the application then exchanges, along with the Client Credentials, for an Access Token. This additional step ensures that only the Client Application has access to the Access Token, preventing the User Agent from ever seeing it.

    But this doesn’t make sense for this use-case. It appears Stripe is needlessly putting us at risk by choosing the Authorization Code Grant.


  • Thanks, but I don’t think this is the case here. The Authentication provider is Stripe (or, at least, it’s a stripe.com domain name). The 3rd party is the app developer’s server.

    Stripe’s infra is already PCI compliant.

    I’m not sure how a hardware security token would be relevant here. The end result must be something-you-know access token. Initial setup is done with 2FA, sure. But I don’t think the server can store (or emulate) a passkey. The issue here isn’t how I authenticate with Stripe. It’s after that – when Stripe gives the tokens to the third party (the dev’s server) and then the third party gives the token to my server. I don’t understand why Stripe doesn’t just let the devs implement it so Stripe gives the tokens directly to my server.