I need to access APIs from Wappler from external services. I’ve used the security provider to restrict access to my API calls. Now I’m trying to figure out how to authenticate to those services externally.
What’s the correct authorization header to authenticate with Wappler serverconnect services?
Is there a way to do this using the API keys either at the server connect level or at the security provider level?
I was able to get this to work by creating a session, calling the login method and passing in the username/password, then subsequently using the session to make additional API calls.
here’s my python code for anyone looking for a code sample:
import requests
url_login= "http://localhost/dmxConnect/api/security/user_login.php"
url_service= "http://localhost/dmxConnect/api/folder/service_name.php"
payload={
'username':username,
'password':password
}
session = requests.Session()
response = requests.request("POST", url_login, data=payload)
response=session.post(url, data=payload) #generates a cookie and returns the user id
response=session.get(url_service) #calls service and returns result