Here a sample python code which runs perfectly (variables username, client_id and client_secret are set):
# First : Get token
auth_url = 'https://sandbox-auth.oxlin.io/token'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
data = { 'grant_type': 'password',
'username': username,
'password' :'Azerty123',
'client_id' : client_id,
'client_secret' : client_secret,
'scope' : 'openid profile accounts_read',
'provider' : 'connect'}
response = requests.post(auth_url, data=data, headers=headers)
access_token = response.json()['access_token'] #Here without checking status code
#Second : Get info about account
account_id = '146566'
url = f'https://sandbox-api.oxlin.io/v2.1/accounts/{account_id}'
headers = { 'Authorization' : 'Bearer %s' % access_token }
data = { }
response = requests.get(url, headers=headers, data=data)
I got the result
{'connection_id': '71124', 'name': 'checkings 1', 'account_number': '12345678901', 'iban': 'FR7630006000011234567890189', 'balance': 159.0, 'currency': 'EUR', 'balance_date': 1721720220, 'type': 'CHECKINGS', 'status': 'ACTIVE', 'creation_date': 1721720219, 'last_channel_definition_id': '8701', 'id': '146566'}
Thus, I try to set it up on Salesforce :
-
Set up External Credentials as ‘custom’ with header ‘Content-Type’ and Principals where I set all pairs key/value of data (note that these values should be sent in body not headers
-
Set up permission set
-
Set up Named Credentials with header ‘Content-Type’
A/ How to pass a different URL for auth and end-point ?
B/ I tried to set up External Credentials as “OAuth2.0” but I did not know how to pass client-id / client_secret AND username / password
Thank you for your help.
#Named Credentials #Integration #Flow