| 1 |
# Token Auth vs Cookie Auth — API Migration Guide |
| 2 |
|
| 3 |
This document explains the differences between the old (deprecated) token-based authentication and the new cookie-based authentication, specifically regarding API request URLs and headers. |
| 4 |
|
| 5 |
## Authentication Methods |
| 6 |
|
| 7 |
### Old: Password Grant (Token Auth) — DEPRECATED |
| 8 |
|
| 9 |
- **Login**: `POST https://{cc}.tmmobile.vorwerk-digital.com/ciam/auth/token` with `grant_type=password` |
| 10 |
- **API base URL**: `https://{cc}.tmmobile.vorwerk-digital.com` |
| 11 |
- **Auth header**: `Authorization: Bearer {access_token}` |
| 12 |
- **Refresh**: Explicit `POST` with `grant_type=refresh_token` |
| 13 |
|
| 14 |
### New: Browser OAuth2 (Cookie Auth) |
| 15 |
|
| 16 |
- **Login**: Browser redirect chain through `cookidoo.{tld}` → CIAM → callback (see [browser-login-flow/README.md](browser-login-flow/README.md)) |
| 17 |
- **API base URL**: `https://cookidoo.{tld}` |
| 18 |
- **Auth header**: None — cookies are sent automatically (`_oauth2_proxy`, `v-authenticated`, `v-is-authenticated`) |
| 19 |
- **Refresh**: Automatic — the OAuth2 proxy handles token refresh transparently |
| 20 |
|
| 21 |
## URL Mapping |
| 22 |
|
| 23 |
The API paths are identical between old and new. Only the base URL (host) changes: |
| 24 |
|
| 25 |
| Old Base URL | New Base URL | Country | |
| 26 |
| --- | --- | --- | |
| 27 |
| `https://ch.tmmobile.vorwerk-digital.com` | `https://cookidoo.ch` | Switzerland | |
| 28 |
| `https://de.tmmobile.vorwerk-digital.com` | `https://cookidoo.de` | Germany | |
| 29 |
| `https://it.tmmobile.vorwerk-digital.com` | `https://cookidoo.it` | Italy | |
| 30 |
| `https://pl.tmmobile.vorwerk-digital.com` | `https://cookidoo.pl` | Poland | |
| 31 |
| `https://ie.tmmobile.vorwerk-digital.com` | `https://cookidoo.co.uk` | Ireland/UK | |
| 32 |
| `https://ma.tmmobile.vorwerk-digital.com` | `https://cookidoo.international` | International | |
| 33 |
|
| 34 |
**Note:** The old URLs used two-letter country codes as subdomains (`ch.tmmobile...`, `de.tmmobile...`). The new URLs use country-specific TLDs (`cookidoo.ch`, `cookidoo.de`) or special domains (`cookidoo.co.uk`, `cookidoo.international`). The correct domain for each tenant is available in the localization data (`localization.url`). |
| 35 |
|
| 36 |
## Request Comparison |
| 37 |
|
| 38 |
### Example: Get Subscriptions |
| 39 |
|
| 40 |
**Old (Token Auth):** |
| 41 |
|
| 42 |
```http |
| 43 |
GET https://ch.tmmobile.vorwerk-digital.com/ownership/subscriptions |
| 44 |
Authorization: Bearer eyJhbGciOiJ... |
| 45 |
Accept: application/json |
| 46 |
``` |
| 47 |
|
| 48 |
**New (Cookie Auth):** |
| 49 |
|
| 50 |
```http |
| 51 |
GET https://cookidoo.ch/ownership/subscriptions |
| 52 |
Cookie: _oauth2_proxy=...; v-authenticated=...; v-is-authenticated=true |
| 53 |
Accept: application/json |
| 54 |
``` |
| 55 |
|
| 56 |
### Example: Get Recipe Details |
| 57 |
|
| 58 |
**Old (Token Auth):** |
| 59 |
|
| 60 |
```http |
| 61 |
GET https://ch.tmmobile.vorwerk-digital.com/recipes/recipe/de-CH/r907015 |
| 62 |
Authorization: Bearer eyJhbGciOiJ... |
| 63 |
Accept: application/vnd.vorwerk.recipe.embedded.hal+json |
| 64 |
``` |
| 65 |
|
| 66 |
**New (Cookie Auth):** |
| 67 |
|
| 68 |
```http |
| 69 |
GET https://cookidoo.ch/recipes/recipe/de-CH/r907015 |
| 70 |
Cookie: _oauth2_proxy=...; v-authenticated=...; v-is-authenticated=true |
| 71 |
Accept: application/vnd.vorwerk.recipe.embedded.hal+json |
| 72 |
``` |
| 73 |
|
| 74 |
### Example: Shopping List |
| 75 |
|
| 76 |
**Old (Token Auth):** |
| 77 |
|
| 78 |
```http |
| 79 |
GET https://ch.tmmobile.vorwerk-digital.com/shopping/de-CH |
| 80 |
Authorization: Bearer eyJhbGciOiJ... |
| 81 |
``` |
| 82 |
|
| 83 |
**New (Cookie Auth):** |
| 84 |
|
| 85 |
```http |
| 86 |
GET https://cookidoo.ch/shopping/de-CH |
| 87 |
Cookie: _oauth2_proxy=...; v-authenticated=...; v-is-authenticated=true |
| 88 |
``` |
| 89 |
|
| 90 |
## What Changes, What Stays the Same |
| 91 |
|
| 92 |
| Aspect | Changes? | Details | |
| 93 |
| -------- | ---------- | ------- | |
| 94 |
| API paths | ❌ No | `/ownership/subscriptions`, `/recipes/recipe/{lang}/{id}`, `/shopping/{lang}`, etc. — all identical | |
| 95 |
| Base URL / host | ✅ Yes | `{cc}.tmmobile.vorwerk-digital.com` → `cookidoo.{tld}` | |
| 96 |
| Authentication mechanism | ✅ Yes | `Authorization: Bearer` header → session cookies | |
| 97 |
| Login flow | ✅ Yes | Single POST with password → multi-step browser redirect chain | |
| 98 |
| Token refresh | ✅ Yes | Explicit refresh_token grant → automatic (proxy-managed) | |
| 99 |
| Response format | ❌ No | Same JSON responses from the backend API | |
| 100 |
| Accept headers | ❌ No | Same content types | |
| 101 |
|
| 102 |
## Why the Change |
| 103 |
|
| 104 |
The `tmmobile.vorwerk-digital.com` endpoint is the mobile app API that requires a Bearer token obtained via the password grant. This grant type is being deprecated. |
| 105 |
|
| 106 |
The `cookidoo.{tld}` endpoint is the web application, which sits behind an OAuth2 proxy. The proxy: |
| 107 |
|
| 108 |
1. Accepts session cookies from the client |
| 109 |
2. Translates them into Bearer tokens internally |
| 110 |
3. Forwards the authenticated request to the same backend API |
| 111 |
|
| 112 |
This means the backend API is the same — only the entry point and authentication mechanism differ. |