Connect mail and GitHub or Google sign-in
Before you begin
- You need
- Shell access to the host, as a user who may use Docker
- An SMTP relay the host can reach
A self-hosted installation sends its email through your mail relay, and can let people sign in with GitHub or Google. Both are settings in .env, applied by running ./mockhub install again.
Without working mail nobody can reset a password, accept an invitation or verify an address, so the relay is required.
-
Set the relay and the sender in
.env:Terminal window MAILER_DSN=smtp://mockhub:secret@smtp.example.com:587MAILER_FROM_ADDRESS=mockhub@example.comMAILER_FROM_NAME=MockHubEncode any special character in the user name or password for a URL, such as
@as%40. -
Set the mailboxes the installation names:
SUPPORT_EMAIL, which emails name and replies reach,ABUSE_EMAILandSECURITY_EMAIL. -
Run
./mockhub install.
Send yourself a password reset from the sign-in page to check it end to end. Emails link to the installation’s own app and documentation, and their replies go to SUPPORT_EMAIL.
Sign-in with GitHub
Section titled “Sign-in with GitHub”-
In GitHub, under your organisation’s Settings → Developer settings → OAuth Apps, register a new OAuth app.
-
Set its homepage URL to the app’s address,
https://UI_HOST, and its authorization callback URL to:https://API_HOST/auth/oauth/github/callbackwith your
API_HOST, such ashttps://api.mockhub.example.com/auth/oauth/github/callback. -
Generate a client secret, and set both halves in
.env:Terminal window OAUTH_GITHUB_CLIENT_ID=Ov23li...OAUTH_GITHUB_CLIENT_SECRET=... -
Run
./mockhub install.
MockHub asks GitHub for read:user and user:email, and uses the account’s primary verified address.
Sign-in with Google
Section titled “Sign-in with Google”-
In the Google Cloud console, create an OAuth client of type Web application for your organisation’s project.
-
Add this authorized redirect URI, with your
API_HOST:https://API_HOST/auth/oauth/google/callback -
Set the client’s ID and secret in
.env:Terminal window OAUTH_GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.comOAUTH_GOOGLE_CLIENT_SECRET=... -
Run
./mockhub install.
MockHub asks Google for openid, email and profile.
Result
Section titled “Result”The sign-in page offers GitHub or Google, under Or continue with, once the provider’s client ID is set; without one, that button is not offered. A first sign-in with a provider creates an account only when the registration mode admits its address, and takes a licence seat like any new account.
Limits
Section titled “Limits”- Set both halves of a pair or neither. The button appears as soon as the client ID is set, and with no secret every sign-in through it fails.
- GitHub and Google are the only providers. There is no SAML, OIDC or other single sign-on.
- The callback is on
API_HOST, not on the app’s host. A provider that still names an old hostname refuses the sign-in after a hostname change, until you update its callback. - Signing in with a provider needs the host to reach it: GitHub’s or Google’s servers, on the internet.