Skip to main content

Authenticate to the SuccessFactors API.

Project description

SuccessFactors Auth

Authenticate with the SAP SuccessFactors API with OAuth2 and Python.

How to use

  1. Create an OAuth application in SuccessFactors.
  2. Download the private key and copy the Client ID.
  3. Install the Python module:
    pip install successfactors_auth
    
  4. Import successfactors_auth into your Python >=3.9 project.
  5. 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
import successfactors_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 = successfactors_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

successfactors_auth-0.0.5.tar.gz (9.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

successfactors_auth-0.0.5-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

successfactors_auth-0.0.5-1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file successfactors_auth-0.0.5.tar.gz.

File metadata

  • Download URL: successfactors_auth-0.0.5.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for successfactors_auth-0.0.5.tar.gz
Algorithm Hash digest
SHA256 77a67c5119af49346a3762bc23c64324c46a7e14e1ff85c3a993c05df2a46198
MD5 9984796cfa2a137c80a2ce36ae28700e
BLAKE2b-256 8d076ffae7649cc613251bba11f0ce03272c2b698ac081fe58350c899bb960d8

See more details on using hashes here.

File details

Details for the file successfactors_auth-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for successfactors_auth-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4bd6c85cf100f365759a35210fd86fc75b486ed0cf124b8c7aafa1857d536ab6
MD5 aa20d558d3be37b017378ca7ce5d1b06
BLAKE2b-256 655a6d91a2fb9e7ecc5be0f341fd1e76304c55e4b200c996e31dc7117d42df86

See more details on using hashes here.

File details

Details for the file successfactors_auth-0.0.5-1-py3-none-any.whl.

File metadata

File hashes

Hashes for successfactors_auth-0.0.5-1-py3-none-any.whl
Algorithm Hash digest
SHA256 af1dcf43d9a732af82912264e665b2b9c8953133c27ad2aaa8c5eb300d9612eb
MD5 c9f79ab3bb78f5b064be0d13d17ad494
BLAKE2b-256 4199ebd1a127f35a85bdc96ca01b8a47369c4fc0c591999e6e9d66164d5b93cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page