Administration

Users and sign-in

Accounts, the owner, passwords and sessions, and signing in with Google, with invites and allowed domains.

Accounts

Everyone who uses Hubstruct has an account: a first and last name, a username, and a password, Google, or both.

The owner

The first account, made during setup, is the owner. The owner can't be removed. Only the owner manages Google sign-in.

Adding people

In Settings → Users, choose Add account and give:

  • their first and last name;
  • a username: letters, numbers, dots, dashes and underscores;
  • a password of at least 8 characters. They can change it on their profile.

Or let them join with Google.

From the same list you can set someone's password, or remove their account. Nobody can remove their own account.

Your profile

Profile, from your avatar in the top bar, has:

  • your profile picture: select it to upload a picture, choose one from the library, or remove yours. Without one, your picture is drawn from your username. You can also right-click any media and choose Make my profile picture. Either way, the picture is cut to a square around what stands out in it;
  • your name and username, and your password;
  • your linked sign-ins, such as Google, to link or unlink;
  • Appearance: your theme and theme color. See Appearance;
  • your API keys. See API keys.

Sessions

Signing in starts a session, kept in a secure, HTTP-only cookie. A session lasts 30 days and is extended while you use it, so you stay signed in on devices you use, and are signed out of ones you don't. Sign out ends it at once.

Passwords are stored as scrypt hashes. Sessions and API keys are stored only as SHA-256 hashes, so even someone with a copy of the database can't use them to sign in.

Signing in with Google

Hubstruct can let people sign in with their Google account. The app does the sign-in with Google using an OAuth client of its own, then hands the API the proof Google gives it. The API only takes that proof from apps the owner has chosen in Settings → Sign-in.

Setting it up

  1. In the Google Cloud console, create an OAuth client ID of type Web application.
  2. Add the app's redirect URI to it: the address you reach Hubstruct at, followed by /auth/google/callback, such as https://photos.example.com/auth/google/callback. Settings → Sign-in shows the exact address.
  3. Give the app the client's ID and secret, in .env, and restart it:
    Terminal
    GOOGLE_CLIENT_ID=1234-abcd.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=GOCSPX-…
    
  4. In Settings → Sign-in, the app's client ID is now shown. Choose Take its sign-ins.

The secret stays with the app. The API only keeps the client IDs it takes sign-ins from. Another app, such as a phone app, has its own OAuth client: add its client ID under Another app's client ID.

Who can join

Anyone whose account has linked Google (from their profile) can always sign in with it. Who can join with Google decides who else gets an account the first time they sign in:

ChoiceWho gets an account
Linked onlyNobody new: only existing accounts that have linked Google.
InvitedAlso anyone whose verified Google email you've invited.
DomainsAlso anyone with a verified Google email at the email domains you list, such as example.com.

Under Invited, add emails with Invite an email; withdraw an invite at any time. An invite is used up when its person first signs in.

Linking Google to an existing account

On your Profile, choose Link Google account and sign in with Google. From then on you can sign in either way. You can unlink it again, as long as you have a password to fall back on.