# OneLogin

This tutorial will explain configuring OneLogin for single sign-on to Pritunl. Users will authenticate through OneLogin when downloading VPN profiles. After a user has downloaded a VPN profile the Pritunl server will use the OneLogin API to verify that the user still exists and is enabled before each VPN connection.

### Create Pritunl App on OneLogin

In the OneLogin admin interface select *New App* and search for *SAML Test Connector (IdP w/ attr w/ sign response)*. Then change the name to `Pritunl` and download the OneLogin Pritunl logos [pritunl.com/img/pritunl\_onelogin.png](https://pritunl.com/img/pritunl_onelogin.png) and [pritunl.com/img/pritunl\_onelogin\_square.png](https://pritunl.com/img/pritunl_onelogin_square.png). Then upload both logos and click *Save*.

![](/files/iDtH9nEhfmQGiJLkQiLn)

On the next page set the *RelayState* to the address your users would use to access the Pritunl server such as `https://vpn.example.com`. Set the *Audience* to `pritunl`. Then enter `https://auth.pritunl.com/v1/callback/saml` as the *Recipient*, *ACS (Consumer) URL Validator* and *ACS (Consumer) URL*. Once done click *Save* and click the *Parameters* tab.

![](/files/KsGmsL7qO98rCMcGOaKH)

On the parameters tab click *Add parameter* and set the *Field name* to `username` and select *Include in SAML assertion* then click *Save*. Then click on the parameter and set the *Value* to `Username`. Do this again using `email` as the name and `Email` as the value.

![](/files/VAsFteJspY1F4cGGW9x4)

![](/files/Rh1nDk3OWfQX1v31BT8r)

### Setting User Organization

By default all OneLogin users will be added to the default organization set in the Pritunl settings. Users can be added to a specific organization using the `org` attribute. This attribute can be mapped to a value such as `Department`. The value of the attribute must exactly match the name of an existing organization on the Pritunl server. If a value is given for an organization that does not exist the user will be added to the default organization. OneLogin provides several mapped values including macros for more customized values. Refer to the OneLogin documentation for setting the value of the `org` attribute to best match Pritunl organizations.

![](/files/lQvGZvw50lu3cUVp1nWh)

### Create API Token

Pritunl will require an API token to validate if a user exists and is enabled before allowing a VPN connection. To create a token click *Settings* then *API* and *New Credential*. Name the token `Pritunl` then select *Manage All* and save the token for later.

![](/files/Szfjh8KFoevnT74Zekwd)

### Add Users to Pritunl App

After the OneLogin app has been created you will need to add users to the Pritunl app before they are able to use it. This can be done in the *Users* tab on the Pritunl app settings on OneLogin.

### OneLogin App Id

Next get the OneLogin app ID from the url in the OneLogin application settings. The ID is the last number component of the URL. For example the ID for this url `https://pritunl.onelogin.com/apps/581429/edit` is `581429`. This ID will be needed in the next step.

### Configure Pritunl

Once the OneLogin app has been configured click on the app then click *Sign On* and *View Setup Instructions*. Then open the Pritunl settings and set *Single Sign-On* to *OneLogin* and set the *Single Sign-On Organization*. This organization will be the default organization OneLogin users are added to. Set the *OneLogin App ID* to the ID from the previous step. Then copy the *SAML 2.0 Endpoint (HTTP)* to *SAML Sign-On URL*. Then *Issuer URL* to *SAML Issuer URL*. Then *X.509 Certificate* to *SAML Certificate*. Use the API token from earlier to fill in *OneLogin API Client ID* and *OneLogin API Client Secret*.

![](/files/9vrJIHMHRysbXI7BOEQq)

![](/files/b1E5lvNgzCk6uFD4tKNp)

### OneLogin API Region

When using OneLogin from the EU the command `sudo pritunl set app.sso_onelogin_region '"eu"'` must be run on one Pritunl host.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pritunl.com/kb/vpn/sso/onelogin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
