Access Data Using Sessions
This guide will show you how to implement a session authorization flow to grant temporary elevated access to your frontend applications using sessions.
Key concepts in this guide:
Getting Started
To get started, you will need a Basis Theory account.
Create a Public Application
Next you will need a Public Application that will be used within our frontend web or mobile application. We will be granting this Public Application just-in-time access to read a token within our frontend application using Sessions.
If you do not already have a Public Application, click here to create one.
Create a Private Application
Next you will need a Private Application that will
be used within our backend service. We will be using this private application to create a token and authorize a session to read this token,
so ensure that you have granted at least the token:create and token:read permissions.
If you do not already have a Private Application with these permissions, click here to create one.
Create a Token
In order to have a token available to reveal to our frontend application in later steps, we will first create a token. For simplicity, we are creating this token through the Basis Theory API using the Private Application created above, however you can imagine this token could have been collected by a frontend application using Elements.
Run the following in your terminal to create the token:
curl "https://api.test.basistheory.com/tokenize" \
-X "POST" \
-H "BT-API-KEY: <PRIVATE_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"type": "token",
"data": {
"first_name": "Luke",
"last_name": "Skywalker",
"social_security_number": "111-22-3333",
"email_address": "luke@skywalkerranch.com"
},
"containers": [ "/" ]
}'
<PRIVATE_API_KEY> with the Private API Key you created in the Create a Private Application step.