Skip to main content

Example: External kiosk sign-in using a Code Interpreter

note

This section is currently under active development. Please check back later.

This example shows how a Code Interpreter can be implemented to allow guests to sign in to accounts connected to external identities in kiosks by e.g. scanning an identifying QR code generated by an external source.

Interpreting an identity code

The diagram above overviews the 4 steps this example Code Interpreter does in order to sign in an external user:

  1. Validate the identity code and extract the external identity.
  2. Authenticate the external identity in Future Ordering and request an access token.
  3. Request a temporary authorization code for the authenticated user using the access token.
  4. Respond to the code interpretation request with a sign-in action containing the user's id and the generated authorization code.

Authenticating the external identity

The Code Interpreter authenticates the user using the backchannel_external_token flow and receives an access token with the fo:auth scope.

info

See authenticating external users without user interaction for more detailed information on this authentication flow.

Requesting an authorization code & sign-in actions

Once the external user has been authenticated and an access token issued, the Code Interpreter can use this access token to call the Future Ordering API on behalf of the user. Using the API, a user can request a temporary authorization code which another system within Future Ordering, e.g. a kiosk, may use to sign in as that user.

The Code Interpreter requests a temporary authorization code and includes it in a sign-in action response, signing in the user scanning the code. A show-modal-dialog action with e.g. a "You are now signed in!" message may also be included. See response actions for more information on available actions.

Example Code Interpreter response with a sign-in action followed by a show-modal-dialog action shown to the user after they are signed in:

{
"owner": true,
"statusCode": "successful",
"code": "some-identity-code",
"actions": [
{
"type": "sign-in",
"userId": "fo456",
"authorizationCode": "xyz"
},
{
"type": "show-modal-dialog",
"title": {
"value": "Welcome!"
},
"message": {
"value": "You are now signed in."
}
}
]
}