How to encode correctly for Sabre OAuth API?

97 Views Asked by At

Based on Sabre documentation i need to encode with Base64 the clientId:password. I did it and put it like per documentation:

Authorization: Basic valueBase64Encoded

But always gets an error

{"error":"invalid_client","error_description":"Credentials are missing or the syntax is not correct"}

I believe i put values correct in Base64 from my account in Sabre with seperate colon.

clientId:password

Also, three x-www-form-urlencoded values are attached to POST : grant_type, username, password

Where is my mistake? Or what should i do here? Thanks for a help

2

There are 2 best solutions below

0
Coti Rassi On

You have to encode your clientId and your password first. Follow this steps:

  1. Encode in Base64 this string V1:{yourUsername}:{yourPCC}:AA
  2. Encode in Base64 your password
  3. Encode in Base64 this {resultOfFirstStep}:{resultOfSecondStep}

The result of the third step should be your encode string

The body grant_type=client_credentials is correct

1
Ben Bartels On

It looks like you are referring to v3 of the API, and Coti is referring to v2 in her answer. I have not had success with v3 yet, but v2 is working for me.