Skip to content

Latest commit

 

History

History
90 lines (68 loc) · 7.17 KB

Tokens.md

File metadata and controls

90 lines (68 loc) · 7.17 KB

Tokens

Authorization code

Token validity Code has validity only 2 minutes

Requests Authorization code

GET
https://login.kb.cz/autfe/ssologin?response_type=code&client_id=Nejlepsiprodukt-4176&redirect_uri=https://client.example.org/callback&scope=adaa%20card_data

Response Authorization code

302 Found
https://client.example.org/callback?code=-_N2RrJRCMgd__JGqUlB_KaFNpo&iss=https%3A%2F%2Fcaas.kb.cz%2Fopenam%2Foauth2&client_id=Nejlepsiprodukt-4176

Refresh token

Token validity refresh_token validity 12 months

Request Refresh token

curl --location --request POST 'https://api-gateway.kb.cz/oauth2/v2/access_token' \
--header 'x-correlation-id: 9f1670dd-db08-4cbb-aa31-ac0454b42657' \
--header 'apiKey: 3a7f779a-8cc1-364f-be2b-9ea161f63817' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'redirect_uri=https://app.kifli.cz/callback' \
--data-urlencode 'code=6W6hsrmHBqN8J6nEW3iPfbB97X8' \
--data-urlencode 'client_id=Kifli-1635' \
--data-urlencode 'client_secret=Xe-_BCRf9mi7uyEzIQiLGA' \
--data-urlencode 'grant_type=authorization_code'

Response Refresh token

{
  "access_token": "eyJ0eXAiOiJKV1QiLCJraWQiOiJJTDdyR3BrMXNzNE9id0VIYmIrQ1RBbEozbzQ9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJBUElJRD0wZTYyNjQxMmJhYzg0Mzc4ODk0ZDFmNjM3MzQ4N2U4NiIsImN0cyI6Ik9BVVRIMl9TVEFURUxFU1NfR1JBTlQiLCJhdXRoX2xldmVsIjo0LCJhdWRpdFRyYWNraW5nSWQiOiIxY2YwY2I4Ni0xNDZmLTRhOTMtOWEzYS00YTQ3MmVkZDJiZmEtMTI3NTA1IiwiaXNzIjoiaHR0cHM6Ly91YXQyLWNhYXMua2IuY3ovb3BlbmFtL29hdXRoMiIsInRva2VuTmFtZSI6ImFjY2Vzc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validity 3 minutes
  • access token is intended to be reused until the time of it's expiration
  • excessive requests to obtain a new access token may result in a status response 429 Too Many Requests

Request Access token

curl --location --request POST 'https://api-gateway.kb.cz/oauth2/v2/access_token' \
--header 'x-correlation-id: 9f1670dd-db08-4cbb-aa31-ac0454b42657' \
--header 'apiKey: 3a7f779a-8cc1-364f-be2b-9ea161f63817' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'redirect_uri=https://app.kifli.cz/callback' \
--data-urlencode 'client_id=Kifli-1635' \
--data-urlencode 'client_secret=Xe-_BCRf9mi7uyEzIQiLGA' \
--data-urlencode 'refresh_token=eyJ0eXAiOiJKV1QiLCJraWQiOiJ3RjJTa1I3NWMxamZsZ1VIOWJ6Wno3Tzllemc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJBUElJRD01MmYwNDgyNjM3OTM0ZGZmOWY5MjE1MTBhMjlhMWYwYSIsImN0cyI6Ik9BVVRIMl9TVEFURUxFU1NfR1JBTlQiLCJhdXRoX2xldmVsIjo2LCJhdWRpdFRyYWNraW5nSWQiOiJlYzU5NDNjZi00ZGE4LTQ3ZDQtYjJmOS05ODNkMmQyYzE4MjEtMTU1ODg3MTgiLCJpc3MiOiJodHRwczovL2NhYXMua2IuY3o6NDQzL29wZW5hbS9vYXV0aDIiLCJ0b2tlbk5hbWUiOiJyZWZyZXNoX3Rva2VuIiwiYXV0aE1vZHVsZXMiOiJQYWFUfFBpY2tlcnxSZXF1ZXN0QmluZGVyfENhYXNBZGFwdGl2ZSIsInRva2VuX3R5cGUiOiJCZWFyZXIiLCJhdXRoR3JhbnRJZCI6IkFRNzBZcFduekpKTmFnc1h4S3BucmoxVWd3NCIsImF1ZCI6IktpZmxpLTE2MzUiLCJhY3IiOiIwIiwibmJmIjoxNjIzNzU3NDM0LCJncmFudF90eXBlIjoiYXV0aG9yaXphdGlvbl9jb2RlIiwic2NvcGUiOlsiYWRhYSJdLCJhdXRoX3RpbWUiOjE2MjM3NTczOTIsIn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GUiOiJyZWZyZXNoX3Rva2VuIiwic2NvcGUiOlsiYWRhYSJdLCJhdXRoX3RpbWUiOjE2NTUzNzcyNzMsInJlYWxtIjoiLyIsImV4cCI6MTY1NTM3NzUzNSwiaWF0IjoxNjU1Mzc3MzU1LCJleHBpcmVzX2luIjoxODAsImp0aSI6IjVqN0d3U1ZWcXlzU0NoX1hoQmxMaUxTTV9MRSIsImNhYXNPcGVyYXRpb25JZCI6IjUyNzYyMTc3NmRiODQ0MTg5MGJjM2MzM2RkZjYzYmVlIn0.Dy_60fOTOclbNVR4gUybTV8XDdcyXxqZoQGoRZq5Ou0PDgJiDcYxKIUMvNQqtW06kEVgCCCvTzrwiVH8ArteCWGMBQnjANwgSm8LB8567tzKN4NxAar3TXSd55ZrDhbk1SbzJyaDnj9qMsIMf9a1u4H6JMeyAGA1MK6XehsJ70dZzN_R6YaB3hG5iMxUG_-z-_cTWs29rPAoFbRUGKuSzaXRyefmiS-pJXgshfoey4YF6swyI3K-MalkzgW1WzGxn7vRwjeQ5VyxNsDsygsjJ90qgcHNqvdglCyWAasMxxqE6CgfVv4J7Ym0fnu9HK0QyPNaUlQNwZ0QeXfSPBSFrg",
  "scope": "adaa",
  "token_type": "Bearer",
  "expires_in": 179
}

How to prolong refresh_token?

  • after expiration refesh token, you can call authrozation to get new refresh token for next 12 months
  • tt is not necessary to register a new application if it is the same KB client that registered the application

Continue to Accounts...