The Golden Pass, by Hand
Цей контент ще не доступний вашою мовою.
Lab for chapter 11, The Burger House: Flows Without a Person, in Securing Salesforce: Identity and Access. The practice asks why each of these steps matters; this page is how to do them.
| You’ll build | A key pair, the Burger House’s external client app with the JWT bearer flow and one pre-authorized permission set, and a JWT you sign yourself that gets a token for Priya while she’s not there |
| Time | About 40 minutes (measured in the lab test, November 2026) |
| Org | The service provider org from chapters 4 to 9 |
| Start from | Priya, a Standard User who can edit Accounts she owns |
| Files | None to download. You make the key pair yourself |
| You need | macOS or Linux, or Windows with Git Bash: bash or zsh, openssl and curl |
| Tested | Winter ‘27 (API 68.0), November 2026 |
Before you start
Section titled “Before you start”-
Log in to the service provider org as the admin.
-
Make a folder of your own for this lab, such as
~/burger-house-lab, not a temporary folder: the computer may empty those overnight, and your key with them. Open a terminal in it. -
Set the org’s address, with your own My Domain:
Terminal window B=https://bluefin-lab-sp-dev-ed.develop.my.salesforce.com
Step 1: Give Priya an Account
Section titled “Step 1: Give Priya an Account”In the lab test, Priya owned no Account. As the admin, open the Accounts tab, select New, enter Account Name Burger House Friday Orders (lab), and Save. Then change its Account Owner to Priya Sharma. Copy the Account’s ID from the address bar: it starts with 001.
ACCOUNT_ID=paste-the-001-id-hereStep 2: Make the Burger House’s key and certificate
Section titled “Step 2: Make the Burger House’s key and certificate”In your folder:
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt -subj "/CN=Burger House lab"server.key is the private key, the seal. server.crt is the certificate, what Salesforce checks the seal against: about 1 KB, well under Salesforce’s 4 KB limit. Only the certificate ever leaves your folder.
Step 3: Make the permission set
Section titled “Step 3: Make the permission set”- From Setup, in Quick Find, enter
Permission Sets, select Permission Sets, then New. - Label:
Burger House: act as. License: —None—. Select Save. - Select Manage Assignments, Add Assignment, tick Priya Sharma only, Next, keep No expiration date, and select Assign.
It carries no permissions. It’s the list of people the Burger House may act as.
Step 4: Make the app
Section titled “Step 4: Make the app”-
From Setup, open External Client App Manager, and select New External Client App.
-
External Client App Name:
Burger House. Check that API Name readsBurger_House. Contact Email: your address. Distribution State: Local. -
Open API (Enable OAuth Settings) and tick Enable OAuth.
- Callback URL:
http://localhost:1717/OauthRedirect. This flow never uses it, but the app needs one. - OAuth Scopes: move Manage user data via APIs (api) and Perform requests at any time (refresh_token, offline_access) to Selected OAuth Scopes.
- Under Flow Enablement, tick Enable JWT Bearer Flow. Under Certificate Upload, select Upload Files and choose
server.crt.
- Callback URL:
-
Select Create.

The certificate Salesforce checks the seal against (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size
Watch out. The JWT bearer flow never gives back a refresh token, but the app still needs the refresh_token scope. In the lab test, with only
api, every pass was refused: “refresh_token scope is required and the connected app should be installed and preauthorized.”
-
On the Policies tab, select Edit, open OAuth Policies, and set Permitted Users to Admin approved users are pre-authorized. Salesforce asks you to confirm: “Enabling this option will result in all users currently using this app being denied access.” Select OK.
-
Under App Policies, which now shows Select Profiles and Select Permission Sets, move Burger House: act as to Selected Permission Sets, and select Save.

The short list of who the app may act as (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size
-
On the Settings tab, open OAuth Settings, select Consumer Key and Secret, and copy the key. You won’t need the secret. In your terminal (zsh; in bash:
read -rsp "Consumer key: " CLIENT_ID):Terminal window read -rs "CLIENT_ID?Consumer key: "; echo
Step 5: Build and sign the golden pass
Section titled “Step 5: Build and sign the golden pass”Put in Priya’s username, then run the rest as it is:
USERNAME="priya.sharma@bluefin-lab-sp.example.com"b64url() { openssl base64 -A | tr '+/' '-_' | tr -d '='; }HEADER=$(printf '{"alg":"RS256"}' | b64url)EXP=$(( $(date +%s) + 180 ))CLAIMS=$(printf '{"iss":"%s","sub":"%s","aud":"https://login.salesforce.com","exp":%s}' "$CLIENT_ID" "$USERNAME" "$EXP" | b64url)SIG=$(printf '%s.%s' "$HEADER" "$CLAIMS" | openssl dgst -sha256 -sign server.key | b64url)JWT="$HEADER.$CLAIMS.$SIG"echo "$HEADER"You should see eyJhbGciOiJSUzI1NiJ9, exactly as in Salesforce’s example. That’s the header. The claims say who it’s from (iss, your key), who it’s for (sub, Priya), where it’s going (aud) and when it expires (exp, three minutes from now). The signature is the first two, sealed with server.key.
Step 6: Present it
Section titled “Step 6: Present it”Within three minutes:
curl -s -X POST "$B/services/oauth2/token" --data-urlencode grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer --data-urlencode "assertion=$JWT"You should see an access_token, "scope":"api", your instance_url, and an id that ends in Priya’s user ID. Look for a refresh token: there isn’t one.
AT=paste-the-access_token-hereTip. In the lab test, a Developer Edition accepted
audashttps://login.salesforce.com, as the org’s own My Domain address, and ashttps://test.salesforce.com.https://example.comwas refused: “audience is invalid”. Usehttps://login.salesforce.comfor a production or Developer Edition org, as Salesforce’s page for this flow says.
Step 7: Do the job, as Priya
Section titled “Step 7: Do the job, as Priya”curl -s -o /dev/null -w "%{http_code}\n" -X PATCH "$B/services/data/v68.0/sobjects/Account/$ACCOUNT_ID" -H "Authorization: Bearer $AT" -H "Content-Type: application/json" -d '{"Description":"Friday delivery done"}'You should see 204: done, nothing to say. Open the Account in Salesforce. Description: “Friday delivery done”. Last Modified By: Priya Sharma. Not an integration user, and not you. And Priya never signed in.
Step 8: Try to break it
Section titled “Step 8: Try to break it”Each break below builds a new pass, so run step 5’s lines again with the change, then step 6.
-
Someone not on the list. Set
USERNAMEto your admin’s username.You should see
"error":"invalid_app_access", “user is not admin approved to access this app”. -
A tampered pass. Build a good pass for Priya (step 5), then swap in claims for someone else and keep Priya’s signature:
Terminal window CLAIMS2=$(printf '{"iss":"%s","sub":"%s","aud":"https://login.salesforce.com","exp":%s}' "$CLIENT_ID" "your-admin-username" "$EXP" | b64url)JWT="$HEADER.$CLAIMS2.$SIG"You should see
"error":"invalid_client", “invalid client credentials”.
Watch out. A pass whose seal doesn’t match its claims doesn’t get a “bad signature” answer: Salesforce says “invalid client credentials”. If you see that with a key you know is right, check that the pass wasn’t changed after it was signed, and that the app has the certificate that matches your
server.key.
-
An old pass. Set
EXP=$(( $(date +%s) - 600 )), ten minutes ago, and build and present it.You should see
"error":"invalid_grant", “expired authorization code”.
Tip. In the lab test, a pass that had expired 60 seconds before was still accepted; four minutes was refused. Salesforce allows a little difference between clocks. Don’t rely on it: give each pass three minutes and use it at once.
Tip. Login History shows every try: in the lab test, Success, Failed: Audience Invalid, Failed: Not approved for access and, for the tampered pass, Failed: Missing Consumer Key Parameter, each with the application Burger House. That’s where an admin looks when a nightly job stops working.
Step 9: Put it away
Section titled “Step 9: Put it away”-
Revoke the token:
Terminal window curl -s -o /dev/null -w "%{http_code}\n" -X POST "$B/services/oauth2/revoke" --data-urlencode "token=$AT" -
Clear the variables:
unset CLIENT_ID USERNAME JWT AT SIG CLAIMS CLAIMS2. -
Keep the app and the permission set for now: later chapters may use them. When you’re finished with the course, remove Priya from Burger House: act as, turn off the JWT bearer flow, and delete
server.key.
Watch out. Whoever has
server.keyand the consumer key can get a token as anyone in Burger House: act as, with no password and no MFA. Keep the key in your own folder, never in a repository, an email or a chat. And keep the permission set short.
Check your lab
Section titled “Check your lab”- Burger House has the JWT bearer flow, your certificate, the scopes
apiandrefresh_token, and Admin approved users are pre-authorized with Burger House: act as. - Priya is the only one in Burger House: act as.
- Your pass got a token whose
idends in Priya’s user ID, and no refresh token. - Her Account says “Friday delivery done”, last modified by Priya.
- The admin’s pass, the tampered pass and the old pass were all refused.
-
server.keyis only in your own folder.
If something went wrong
Section titled “If something went wrong”From the lab test, November 2026:
- “refresh_token scope is required…”. Add Perform requests at any time (refresh_token, offline_access) to the app (step 4).
invalid_app_access. The user isn’t in Burger House: act as, or the permission set isn’t on the app’s policies (steps 3 and 4).- “invalid client credentials”. The pass was changed after signing, the consumer key is wrong, or the app has a different certificate (step 8).
- “audience is invalid”. Check
aud(step 6). - “expired authorization code”. More than three minutes passed: build a new pass (step 5).
- “user hasn’t approved this consumer”. The username in
subdoesn’t exist in this org; check the spelling.
About the SAML bearer assertion flow
Section titled “About the SAML bearer assertion flow”Module 3 sets the SAML bearer assertion flow beside this one: the same idea, with a signed SAML assertion instead of a JWT. This lab doesn’t build it. Signing a SAML assertion needs an XML signing tool on your computer, and the lab test didn’t try it with an external client app: check Salesforce’s current page for the flow before you build one.
What you just proved
Section titled “What you just proved”A system with nothing but a private key got a token for a named person who wasn’t there, and changed her record as her. Salesforce checked four things before saying yes: that the pass was sealed by the key whose certificate it holds, that it was for this org, that it hadn’t expired, and that the person was on the app’s short list. Change any one, and it said no.
Next lab: more labs come in a later release, starting with chapter 10, From One Org to the Other, and chapter 12, Getting Users In and Out. Keep both orgs, your apps and Priya’s permission set until then.
