Support headless auth using security tokens

As a developer, I want to create daemons/services that can perform unattended authentication in an industry-standard way.

Currently, the lack of headless authentication requires workarounds that diverge from industry best practices.

  • Background

  • Issue

    • Is a nonstandard use of authorization code grant flow.

    • Requires a data store.

    • Violates the principle of least surprise.

    • Is unnecessary for running in a user context.

  • Proposal

    • Enable a truly noninteractive flow like resource owner password credentials, but require users to append security tokens to their passwords in token requests.

    • Salesforce does this for connected apps. The user generates a security token in their profile settings, then appends it to their password when authenticating in a connected app.

    • PowerShell example

      • Invoke-RestMethod 'https://login.salesforce.com/services/oauth2/token' -Method Post -Body 'grant_type=password&username=<MyUsername>&password=<MyPassword><MySecurityToken>&client_id=<MyClientId>&client_secret=<MyClientSecret>' -ContentType 'application/x-www-form-urlencoded'

  • Guest
  • Oct 6 2020
  • Attach files
  • Steven Cinquegrana commented
    June 16, 2021 17:22

    Just saw this. Any (secure) option that doesn't require manual auth would be a a huge step forward, I think. I have no problem with HTTP Basic Auth either (which is used to obtain initial auth tokens anyway).

  • Nathan Wells commented
    June 16, 2021 17:04

    Yes, please! We don't like the idea of our payment processing going down just because there was an error (either in our code, or network down time) when we get a new refresh token. Headless auth would fix this, or something like allowing the previous 5 refresh tokens to be used so we can retry when there is a failure. Currently if there is a failure it requires a manual step to re-authenticate, which causes downtime (meaning payments can't be accepted etc). And that isn't really an acceptable option.