Can't get the refresh token with CURL
Closed this issue · 2 comments
Hello,
For some reason, I can't this to work.
I send something like :
curl -X POST -d "refresh_token=AQBPpxT_ONXVEosayhTQHhmQPhxAPqyVWpq_4YnN4dzMVfGatvfg9QyRywtrux-0zTuTKD3OdZ0SguXIEW20__6gtOG8b-2sNw78yCQrDEWG4LgOhJMptaPtLliMz7cExNE" https://zikup-refresh.herokuapp.com/api/refresh_token
but I always get the following result:
{"error":"invalid refresh_token"}%
I have tried to put the refresh token, the access_token but it doesn't work.
Note that the tokens I'm testing are still valid (less than 1h)
Also the callback uri is the one of the iOS app from which I have requested these tokens. I guess it's what is intended.
Any help welcome...
Additional info, when I try to do this from the CLI, I get more details about the error:
~ $ bin/refresh_token "BQBYTvsAE4rdO0zqZZeQBNKs_0ZPcReahvO4TnC2DCRfslyB-0M971VK2XMwjYIE4BcAAO672hH8CmXVawqyTWhFKuD5ZbZcTWD6OS8GJgkd_iX2wkdDQmVjGWL-sC4uqDJE01Ro52_kgE4M6X-uznDfxp4be3kNR4gB0nWR" /app/vendor/bundle/ruby/2.6.0/gems/encrypted_strings-0.3.3/lib/encrypted_strings/symmetric_cipher.rb:96: warning: constant OpenSSL::Cipher::Cipher is deprecated Traceback (most recent call last): 5: from bin/refresh_token:14:in
4: from /app/spotify_token_swap_service.rb:146:in
run' 3: from /app/spotify_token_swap_service.rb:154:in
decrypt_refresh_token'2: from /app/vendor/bundle/ruby/2.6.0/gems/encrypted_strings-0.3.3/lib/encrypted_strings/extensions/string.rb:101:in
decrypt' 1: from /app/vendor/bundle/ruby/2.6.0/gems/encrypted_strings-0.3.3/lib/encrypted_strings/symmetric_cipher.rb:85:in
decrypt'/app/vendor/bundle/ruby/2.6.0/gems/encrypted_strings-0.3.3/lib/encrypted_strings/symmetric_cipher.rb:85:in
final': wrong final block length (OpenSSL::Cipher::CipherError)
Solution found. I had to change the ENCRYPTION_SECRET variable...