Fork me on GitHub

This page in other versions: Latest (8.9) | 8.8 | 8.7 | 7.8 | 6.21 | Development

This document in other formats: PDF | ePub | Tarball


Enabling OAUTH2 Authentication

To enable OAUTH2 authentication for pgAdmin, you must configure the OAUTH2 settings in the or file (see the documentation) on the system where pgAdmin is installed in Server mode. You can copy these settings from file and modify the values for the following parameters:




The default value for this parameter is internal. To enable OAUTH2 authentication, you must include oauth2 in the list of values for this parameter. you can modify the value as follows:

  • [‘oauth2’, ‘internal’]: pgAdmin will display an additional button for authenticating with oauth2


The name of the Oauth2 provider, ex: Google, Github


Oauth2 display name in pgAdmin


Oauth2 Client ID


Oauth2 Client Secret


Oauth2 Access Token endpoint


Endpoint for user authorization


Server metadata url for your OAuth2 provider


Oauth2 base URL endpoint to make requests simple, ex:


User Endpoint, ex: user (for github) and useinfo (for google)


Oauth scope, ex: ‘openid email profile’. Note that an ‘email’ claim is required in the resulting profile.


The Font-awesome icon to be placed on the oauth2 button, ex: fa-github


Oauth2 button color


The claim which is used for the username. If the value is empty

the email is used as username, but if a value is provided, the claim has to exist. Ex: oid (for AzureAD)


Set the value to True if you want to automatically

create a pgAdmin user corresponding to a successfully authenticated Oauth2 user. Please note that password is not stored in the pgAdmin database.


If a dictionary is provided, pgAdmin will check for a matching key and value on the userinfo endpoint

and in the Id Token. In case there is no match with the provided config, the user will receive an authorization error. Useful for checking AzureAD wids or groups, GitLab owner, maintainer and reporter claims.


Set this variable to False to disable SSL certificate verification for OAuth2 provider.

This may need to set False, in case of self-signed certificates.

Redirect URL

The redirect url to configure Oauth2 server is <http/https>://<pgAdmin Server URL>/oauth2/authorize After successful application authorization, the authorization server will redirect the user back to the pgAdmin url specified here. Select https scheme if your pgAdmin server serves over https protocol otherwise select http.

Master Password

In the multi user mode, pgAdmin uses user’s login password to encrypt/decrypt the PostgreSQL server password. In the Oauth2 authentication, the pgAdmin does not store the user’s password, so we need an encryption key to store the PostgreSQL server password. To accomplish this, set the configuration parameter MASTER_PASSWORD to True, so upon setting the master password, it will be used as an encryption key while storing the password. If it is False, the server password can not be stored.

Login Page

After configuration, on restart, you can see the login page with the Oauth2 login button(s).

Oauth2 login