| 1 |
# FAQ |
| 2 |
|
| 3 |
## Q: Why does the browser show `Access denied`? |
| 4 |
|
| 5 |
A: `Access denied` is the generic page for an unsuccessful authentication flow. |
| 6 |
It does not identify the cause and does not necessarily mean that the identity |
| 7 |
provider rejected the user or that an authorization policy denied access. |
| 8 |
|
| 9 |
The underlying failure can occur at different stages, including session and |
| 10 |
cookie handling, the OIDC callback, authorization-code exchange, token |
| 11 |
validation, user validation, or communication with the identity provider. |
| 12 |
Some upstream handlers also report several failure types through the same |
| 13 |
error path, so openvpn-auth-oauth2 cannot always classify them reliably. |
| 14 |
|
| 15 |
The browser response remains generic so authentication and infrastructure |
| 16 |
details are not exposed publicly. |
| 17 |
|
| 18 |
> [!IMPORTANT] |
| 19 |
> Ask the user for the unique **Error ID** displayed at the bottom of the page. |
| 20 |
> Search the openvpn-auth-oauth2 logs for the matching `error_id` value to find |
| 21 |
> the actual failure. |
| 22 |
|
| 23 |
For example, text-formatted logs contain a field similar to: |
| 24 |
|
| 25 |
```text |
| 26 |
error_id=<error-id-from-the-browser> |
| 27 |
``` |
| 28 |
|
| 29 |
The Error ID is a unique correlation value for that individual failure, not a |
| 30 |
reusable error code or a description of the problem. Use the matching log entry |
| 31 |
to determine the cause and the appropriate troubleshooting steps. |
| 32 |
|
| 33 |
See [issue #1121](https://github.com/jkroepke/openvpn-auth-oauth2/issues/1121) |
| 34 |
for an example where the generic page represented an infrastructure failure. |
| 35 |
|
| 36 |
## Q: openvpn-auth-oauth2 authenticates the user on every connection |
| 37 |
|
| 38 |
A: No, it isn’t possible to implement a Remember Me or a caching credential function directly within openvpn-auth-oauth2 or OpenVPN. |
| 39 |
This limitation arises from the inability of openvpn-auth-oauth2 to store client cookies. |
| 40 |
While some OIDC providers like Keycloak offer a [Remember Me](https://www.keycloak.org/docs/latest/server_admin/index.html#enabling-remember-me) feature, |
| 41 |
enabling automatic login would need implementation within the OIDC provider's settings rather than within openvpn-auth-oauth2 itself. |
| 42 |
|
| 43 |
## Q: openvpn-auth-oauth2 re-authenticates the user on existing connections |
| 44 |
|
| 45 |
A: Read the following documentation to understand the re-authentication behavior: |
| 46 |
|
| 47 |
- [Non interactive session refresh](Non-interactive%20session%20refresh) |
| 48 |
|
| 49 |
For the Google Provider, |
| 50 |
expand the page [Providers](Providers) and look for Google consent screen always asking for permission grant. |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
## Q: `Provider did not return a id_token. Validation of user data is not possible.` is logged, but my provider is returning an id_token. |
| 55 |
|
| 56 |
A: This could happen, if `oauth2.endpoint.auth` and `oauth2.endpoint.token` are defined. In this case, |
| 57 |
the underlying works in OAUTH2 mode, and the id_token is not recognized. |
| 58 |
If user validation is needed, remove `oauth2.endpoint.auth` and `oauth2.endpoint.token` from the configuration. |
| 59 |
|
| 60 |
## Q: Why openvpn-auth-oauth2 logout the user from OIDC server after the VPN session was terminated? |
| 61 |
|
| 62 |
A: The openvpn-auth-oauth2 plugin doesn’t log out the user from the OIDC server |
| 63 |
after the VPN session ends because the OpenID Connect (OIDC) protocol’s end session endpoint, |
| 64 |
while available, isn’t suitable in this context. |
| 65 |
The end session endpoint generates a URL |
| 66 |
intended for the end user to manually initiate the logout process via their browser. |
| 67 |
Since OpenVPN operates without direct interaction with the user's browser upon logout, |
| 68 |
there's no mechanism to automatically open the URL for the user. |
| 69 |
|
| 70 |
Instead of attempting a user logout, the recommended approach to configure short session lifetimes. |
| 71 |
This ensures that OIDC sessions aren’t reused after a VPN session terminates, minimizing the risk of session misuse. |
| 72 |
|
| 73 |
It's also worth noting that for an attacker to reuse a session with openvpn-auth-oauth2, |
| 74 |
they’d need a valid OpenVPN session cookie from an active and authenticated connection. |
| 75 |
This requirement provides an additional layer of security, |
| 76 |
as getting a cookie is highly unlikely without a prior compromise. |
| 77 |
|
| 78 |
## Q: If the refresh token expires, OpenVPN keeps opening browser sessions endlessly. How can I prevent that? |
| 79 |
|
| 80 |
A: This behavior can occur if the OpenVPN client is configured to retry authentication using the auth-retry option. |
| 81 |
By default, OpenVPN does not retry after an AUTH_FAILURE, but if auth-retry is set (e.g., to interact or nointeract), it may trigger repeated browser sessions. |
| 82 |
|
| 83 |
In addition, some server-side settings can cause re-authentication loops. |
| 84 |
|
| 85 |
A common issue is the inactive directive on the OpenVPN server. |
| 86 |
If it’s set lower than the authentication timeout, OpenVPN may interrupt the session too early, restarting the auth process. |
| 87 |
|
| 88 |
To avoid this, ensure the inactive timeout is higher than the auth timeout. |
| 89 |
You can find the auth timeout value in the OpenVPN server logs by searching for: |
| 90 |
|
| 91 |
``` |
| 92 |
AUTH_PENDING,timeout |
| 93 |
``` |
| 94 |
|
| 95 |
If the log shows timeout=60, then set inactive to at least 65 — always add 5 seconds to the timeout value as a safety margin. |