Sub topic 7
Profile files and authenticating a recipient
This chapter assumes you know what a share, schema and table are, and how the sharing server answers reads with pre-signed URLs. It also assumes basic HTTPS and bearer-token knowledge. Here you will learn what a profile file contains, how it authenticates a recipient, and what commonly goes wrong.
What a profile file is
A profile file is a small JSON file that the provider gives to the recipient. It holds two things the client needs: the address of the sharing server and a credential. Delta Sharing connectors read this file and attach the credential to every REST call.
{
"shareCredentialsVersion": 1,
"endpoint": "https://sharing.example.com/delta-sharing/",
"bearerToken": "<token>",
"expirationTime": "2030-01-01T00:00:00.0Z"
}| Field | Meaning |
|---|---|
| `shareCredentialsVersion` | Version of the profile format. The value is `1`. |
| `endpoint` | Base URL of the sharing server. |
| `bearerToken` | Secret that identifies the recipient. |
| `expirationTime` | Time after which the token stops working. |
The file is conventionally named with a .share extension, for example config.share. The extension is a convention only. Connectors read the file contents.
How authentication works
Delta Sharing uses bearer-token authentication. The client sends the token in an HTTP header on each request:
Authorization: Bearer <token>The server checks the token. If it is valid and not expired, the server finds which shares that recipient may read and answers. Otherwise it rejects the call.
The token authenticates the recipient only against the sharing server. The data files live in cloud storage and are fetched through pre-signed URLs. Those URLs are short-lived and are issued only after the token check passes. The recipient therefore needs no cloud account or storage credentials of its own.
Using the profile from a client
The first thing most recipients do is list what they can see. SharingClient takes the path to the profile file.
import delta_sharing
profile = "config.share"
client = delta_sharing.SharingClient(profile)
for table in client.list_all_tables():
print(table)If this prints your tables, the endpoint and token are both working. Later chapters use the same profile inside table URLs, which are the profile path, a #, and share.schema.table.
Handling the token safely
The bearer token is a secret. Anyone holding the file can read everything the recipient is granted, so treat it like a password.
- Do not commit profile files to source control.
- Store them in a secrets manager or a file with restricted permissions.
- Do not paste them into tickets or chat.
- Ask the provider for a new token if you suspect exposure.
Expiry and rotation
The expirationTime field tells the recipient when the token stops working. A short lifetime limits damage from a leak, but it forces the provider to issue replacements and the recipient to install them. Plan for this before the date arrives.
A practical routine looks like this:
- Read
expirationTimefrom the profile when your job starts. - Alert well before that date, for example 14 days.
- Request a new profile from the provider.
- Swap the file in your secret store, then rerun a small read to confirm.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong, expired or revoked token | Check `expirationTime`. Request a new profile. |
| Connection or DNS error | Wrong `endpoint`, or the server is not reachable from your network | Check the URL and firewall rules. |
| Empty table list | Token is valid, but no shares were granted | Ask the provider to grant access. |
| Table not found | Wrong `share.schema.table` name in the URL | List tables first and copy the names. |
| File not found for the profile | Relative path resolved from the wrong directory | Use an absolute path. |
Note the difference between an authentication problem and an authorization problem. A 401 means the server does not accept your token. An empty list means the token is accepted, but nothing is granted to you.
Exercise
Your job fails with a 401 error. A colleague on another team, using a different profile from the same provider, can list tables normally. Name two things to check in your profile file.
Show answer
Check whether expirationTime has passed, and whether the token was revoked or replaced by the provider. Also confirm that you are using the profile issued to your recipient and that the token was copied without changes.
Exercise
Why does a recipient not need cloud storage credentials to download the table's data files?
Show answer
After validating the bearer token, the sharing server returns short-lived pre-signed URLs. These URLs carry the permission to read specific files, so the client downloads them directly without its own storage credentials.