Authenticate to the SuccessFactors API.
Project description
SuccessFactors Auth
Authenticate with the SAP SuccessFactors API with OAuth2 and Python.
How to use
- Create an OAuth application in SuccessFactors.
- Download the private key and copy the Client ID.
- Install the Python module:
pip install successfactors_auth
- Import
successfactors_authinto your Python >=3.9 project. - Call the
successfactors_auth.auth()function in your Python project. You'll need to pass the following parameters:sf_url: Base API url of your SuccessFactors instance, e.g. "https://api55.sapsf.eu".sf_company_id: SuccessFactors company ID.sf_oauth_client_id: The Client ID for the OAuth application you created earlier.sf_admin_user: An admin user in SuccessFactors that has access to the OAuth application.sf_saml_private_key: Path to the private key file you downloaded when you created the OAuth application.
Example
#!/usr/bin/env python
import requests
from successfactors_auth import auth as sf_auth
sf_url = 'https://your.base.url.com'
sf_company_id = 'your-company-id'
sf_oauth_client_id = 'your_app_client_id'
sf_admin_user = 'your_admin_user'
sf_saml_private_key = 'your_app_private_key.pem'
token = sf_auth.auth(
sf_url,
sf_company_id,
sf_oauth_client_id,
sf_admin_user,
sf_saml_private_key,
sf_saml_template
)
headers = {
"Accept: application/json",
f"Authorization: {token}"
}
request = requests.get(f"{sf_url}/User", headers=headers)
user = request.json()
print(user)
Background
I wrote this module because I was forced to deal with the horrific SAP SuccessFactors API at my job, and I wanted to make sure other devs/sysadmins wouldn't have to feel the pain that I felt.
Once you get authenticated, getting the information you want is a whole new level of suffering. I hope to publish some more examples in the form of a blog post or docs in this repo.
Contributing
All contributions welcome! Feel free to file an issue or open a pull request.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file successfactors_auth-0.0.8.tar.gz.
File metadata
- Download URL: successfactors_auth-0.0.8.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acc01b80845f4ffbdbfdb42790f950d4cee2fa31485229ba1feddad2148e38ac
|
|
| MD5 |
d9bb379dd2d2f5170ea6601e90d9f2d3
|
|
| BLAKE2b-256 |
1f7e2a7e9803414f29e8b60ed1d36a45a6ff1545cba30ce00094476939e0ec3c
|
File details
Details for the file successfactors_auth-0.0.8-py3-none-any.whl.
File metadata
- Download URL: successfactors_auth-0.0.8-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bab2f6a63f6108a894a44f41d73f960392b6e6ff912a5e3042c5094099da812
|
|
| MD5 |
46731875aa19a63f6702386a71a95fe5
|
|
| BLAKE2b-256 |
d968485f4e0b74ec8acd327efda7cd32f79bcd3d57d08b0bab89a86cb5a84aff
|