Important
The seamless-exchange flow is subject to strict governance and will not be granted without justification.
The seamless exchange allows a Décathlon mobile app
to identify seamlessly the member in the webviews integrated to the Décathlon mobile app for several usages:
The seamless-exchange flow is subject to strict governance and will not be granted without justification.
The seamless-exchange process has two major actors:
The process must respect the reference specification:
RFC 8693: OAuth 2.0 Token Exchange
The exchangeable token is an id_token with:
client_credentials
.
It prevents the generation of an access token with too wide scopes.
POST | /connect/token/exchange |
Name | Description | Required |
---|---|---|
Authorization |
Two choices:
|
Yes |
Content-type | application/json | Yes |
Parameter | Description | Required |
---|---|---|
grant_type |
urn:ietf:params:oauth:grant-type:token-exchange
|
Yes |
exchange_type |
urn:decathlon:params:oauth:exchange-type:seamless-exchange
|
Yes |
requested_token_type |
If present, must be set to the following value:
urn:ietf:params:oauth:token-type:access_token
|
No |
subject_token_type |
urn:ietf:params:oauth:token-type:id_token
|
Yes |
subject_token |
The id token of the member.
|
Yes |
scopes |
A list of scopes to set in the exchangeable token.
If specified, the scopes of the client B must contain every scope of this parameter (if a requested scope is not in the client list, an error will be thrown). If not specified, all the scopes of the client B are set in the exchangeable token. |
No |
In case of success, regarding the specification
RFC 8693: OAuth 2.0 Token Exchange
,
the response will have the following characteristics:
Detail of the attributes contained in the JSON response body
Name | Description | Required |
---|---|---|
access_token |
A standard access token. It's neither an impersonation nor a delagation. Then, the claims act and may_act won't be used.
|
Yes |
issued_token_type |
urn:ietf:params:oauth:token-type:access_token
|
Yes |
token_type |
bearer
|
Yes |
expires_in | token validity, in seconds | Yes |
scope | scopes list included in the access token, space separated | Yes |
refresh_token | If configured for the client, a refresh token allowing to obtain a new access-token with the same scopes and audience | No |
Any missing mandatory parameter generates an invalid_request
HTTP 400 error.
Any parameter with an invalid value generates an invalid_request
HTTP 400 error.
Some forbidden parameters can also generate an invalid_request
HTTP 400 error if present: resource, audience, actor_token_type, actor_token.
curl -X POST --location 'https://api-global.preprod.decathlon.net/connect/token-exchange' \
--header 'Authorization: Basic BASE64_AUTH' \
--header 'Content-Type: application/json' \
--data DATA
curl -X POST --location 'https://api-global.preprod.decathlon.net/connect/token-exchange' \
--header 'Authorization: Basic Y2xpZW50LXRva2VuLWV4Y2hhbmdlLXNlYW1sZXNzOmNsaWVudC10b2tlbi1leGNoYW5nZS1zZWFtbGVzcy1zZWNyZXQ=' \
--header 'Content-Type: application/json' \
--data '{
"grant_type":"urn:ietf:params:oauth:grant-type:token-exchange",
"exchange_type":"urn:decathlon:params:oauth:exchange-type:seamless-exchange",
"requested_token_type":"urn:ietf:params:oauth:token-type:access_token",
"subject_token_type":"urn:ietf:params:oauth:token-type:id_token",
"subject_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJmNTk2NzYwZC00ZGFjLTQxNTItOGMzMS0zOWY1ZjhhYmE0NTAiLCJhdWQiOlsiL3Rva2VuL2V4Y2hhbmdlIiwiY2xpZW50LXRva2VuLWV4Y2hhbmdlLXNlYW1sZXNzIiwiY2xpZW50LXNlYW1sZXNzIl0sImF6cCI6ImNsaWVudC1zZWFtbGVzcyIsImF1dGhfdGltZSI6MTY3NzU5NTc1NywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo5OTk5IiwiZXhwIjoxNjc3NTk2NjU3LCJpYXQiOjE2Nzc1OTU3NTcsImp0aSI6IklELmFFMHdmNEdnN1lSSTFpNlU4NVIxOTJuMkplcyJ9.TYHo539OjPZwGPw2f_w28KAIqA2H352p3rYWVZqeFv6vnJ4U0r9XFxcBhKwJfUi1s33DLkxd50zHb8TO5RT1hS9IdqKpUFQ-m0IeVZWG8IuKyLIDD6YefxA7zR2ChXIl-PuyXOWdk-PThToJA0JbXfwzceV2mCgTdyCq3zw1ETJ54kwT3vM47TPi8I7qGiNodp1j6IQIMqHivphVrsxH05mJMMzCXy86ZqP6zmrdUBm8tXf2NHRSO03Svf79lRNQN-NBN9pJLnhWxQ_mE1pI9vrjR4ifmS0NB1qphhq_8bvJz37MgmughUmzotAq1BaqYSn6ECROcU4fW1lcIqD8LA",
}'
In response you will get a JSON object
{
"access_token": "eyJraWQiOiJtYWluIiwidHlwIjoiSldUIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTk2NzYwZC00ZGFjLTQxNTItOGMzMS0zOWY1ZjhhYmE0NTAiLCJuYmYiOjE2Nzc1OTU1NzAsInNjb3BlIjpbIm9wZW5pZCIsInByb2ZpbGUiLCJlbWFpbCIsImNvbnRhY3RzIl0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo5OTk5IiwibG9jYXRpb24iOiJGUiIsImV4cCI6MTY3NzU5NjQ3MCwiaWF0IjoxNjc3NTk1NTcwLCJqdGkiOiIwYWFjZjZhYi03YjZhLTRkNmMtOTY1MC02ZjgxM2FlNjVhZjMiLCJjbGllbnRfaWQiOiJjbGllbnQtdG9rZW4tZXhjaGFuZ2Utc2VhbWxlc3MifQ.OJn_nkIlJRmIvsHLJKg6ruvycYTT5i2Yi6iimJuw1E53cDpFN9Bjy9NQqAOePtLjrVt56rap-y-hCTGMmX68uM5yfcnN6mCMZRHe19R57hpmEv2iXTLS4sj7JytvH5plKW6SfeogfoQGmIaXRsDsV4-OQNN5Hj3HDbozNyWKt6NXYgHpf4RXgyRmXCZKtqYZAiwMBIgCwkIJaz0fjlUZ7QsomhbL3-WIEEcs7SebqTuyskWvmku2he9Frhi1Xd2-3eiEUscYOdM4KYMZ1X8BCyD0ARg2oLUvXlKurt_XLEB9vI6SzsvaBJl8K0ZK4sd-Oj3TspnVKGcJSgK62W82hA",
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token",
"scope": "openid profile email contacts",
"token_type": "Bearer",
"expires_in": 899
}