I want to use secrets from KeyVault to authenticate credentials in Spotify API (spotipy). I set client id and secret key in KeyVault Secrets. In databricks I have:
client_id = dbutils.secrets.get(scope = 'ClientID', key = 'ClientID')
secret = dbutils.secrets.get(scope = 'SecretKey', key = 'SecretKey')
and it works because I get [REDACTED]
from above variables.
When I use this vars in order to authenticate I get:
SpotifyOauthError: error: invalid_client, error_description: Invalid client
Keys work fine when I put them straight into Spotify API. What can be the cause of it? Should I decrypt them somehow before sending to API, but that seems to be senseless.
CodePudding user response:
Here is a link to the documentation.
How do you know if the secret in the scope is correct?
You can use this function to verify the information stored in the key vault backed secret scope is correct. It decodes the secret into text with a space between each character.
For the life of me, I don't know why ret.strip() would get ride of the single spaces. Something to add to my to-do.
In short, a redacted variable should be able to be passed as a text parameter without issue.