python-social-auth / social-core

Python Social Auth - Core
BSD 3-Clause "New" or "Revised" License
844 stars 544 forks source link

Support OneLogin as backend #656

Open dan-tabarca opened 2 years ago

dan-tabarca commented 2 years ago

As Python-social-auth library supports many backends, would be great if it can support also authentication with OneLogin.

ezrajrice commented 1 year ago

Not sure if you have already figured this out, but you can use the OpenIdConnectAuth backend for OneLogin. The important settings to configure in the OAUTH_CONFIG section are

  SOCIAL_AUTH_ONELOGIN_OIDC_KEY: <sso_key>
  SOCIAL_AUTH_ONELOGIN_OIDC_SECRET: <sso_secret>
  SOCIAL_AUTH_ONELOGIN_OIDC_ENDPOINT: https://example.onelogin.com/oidc/2
  SOCIAL_AUTH_ONELOGIN_OIDC_TOKEN_ENDPOINT_AUTH_METHOD: POST

The TOKEN_ENDPOINT_AUTH_METHOD defaults to GET so if the SSO is configured to only accept POST requests, then it needs to be set here. Hope this helps.

NOTE: I've been working in a project that sub-classed OpenIdConnectAuth so that we could redefine the OIDC_ENDPOINT property for simplicity so just double check the above key value pairs have the correct keys.