Google, GitHub and Microsoft

An optional way in for accounts that already exist — the second factor still applies.

Checkin can let people sign in with an existing Google, GitHub or Microsoft account instead of typing their Checkin password. The feature is built on Laravel Socialite (Google and GitHub) and socialiteproviders/microsoft (Microsoft personal and work/school accounts). It is off until you configure it: each provider appears on the login page only once its client id and secret are set.

Is it worth it here?#

Checkin is the identity provider for every other application: an external account that can sign in to Checkin can sign in to all of them. So the question is not "is it convenient?" but "is that external account at least as safe as a Checkin password?".

ForAgainst
One click for people who already live in Google Workspace, Microsoft 365 or GitHubEvery connected Google/GitHub/Microsoft account becomes another key to every app
No password to remember, or to resetCheckin depends on the provider being up and on its OAuth app staying configured
The provider's own protections (its 2FA, device checks, Workspace/Entra policies) applyCheckin cannot see whether the person used 2FA at the provider
Disabling the person at the provider (e.g. leaving the company) stops that route inIt does not stop the password or passkeys: suspending the person in Checkin is still what locks them out

Recommendation

  • Worth enabling when the people are already managed somewhere else — a company on Google Workspace or Microsoft 365 (with MICROSOFT_TENANT set to that tenant), or a team of developers who all use GitHub with 2FA turned on.
  • Not worth it for a handful of people who already use passkeys: a passkey is phishing-resistant and needs no third party, so it is the better "no password" option. Leave the variables empty and nothing changes.
  • Whatever you choose, ask people with access to sensitive applications to turn on TOTP in Checkin: it is still asked after a Google/GitHub/Microsoft sign-in (see below).

This is why the implementation is opt-in per provider, never creates accounts, and keeps Checkin's second factor.

What people see#

On the login page, under the passkey button, one button per enabled provider ("Google", "GitHub", "Microsoft"; "Continue with Google" when only one is enabled), then Or continue with email and the usual form.

The sign-in page with a passkey, Google, GitHub and Microsoft, then the e-mail form

In Settings → Security, a Connected accounts section lists the enabled providers with, for each one, the connected identity (e-mail or GitHub handle, last use) and a Connect or Disconnect button.

In Administration → People → a person, a Connected accounts card lists the identities connected to that person, each with a button to disconnect it.

Nothing is shown anywhere while no provider is configured.

How a sign-in works#

Text
 Browser                          Checkin                                   Google / GitHub / Microsoft
    │  click "Google"                 │                                                  │
    │ ───────────────────────────────▶│ GET /auth/google/redirect                        │
    │                                 │  state → session, redirect ─────────────────────▶│
    │                                 │                                                  │ person signs in there
    │◀────────────────────────────────────────────────────────── redirect with code+state │
    │ ───────────────────────────────▶│ GET /auth/google/callback?code&state             │
    │                                 │  checks state, swaps code for a token ──────────▶│
    │                                 │  reads the profile (id, e-mail, name) ◀──────────│
    │                                 │  social_accounts: (google, id) → person?         │
    │                                 │   ├─ none       → back to /login with a message  │
    │                                 │   ├─ TOTP on    → /two-factor-challenge          │
    │                                 │   └─ otherwise  → signed in                      │
    │◀────────────────────────────────│  redirect to the intended URL or /dashboard      │

Step by step:

  1. GET /auth/{provider}/redirect (guests only). Socialite stores a random state in the session and sends the browser to the provider's consent page, with APP_URL/auth/{provider}/callback as the return address.
  2. The person signs in at the provider (with whatever the provider asks: password, its own 2FA, a Workspace/Entra policy…) and approves Checkin the first time.
  3. GET /auth/{provider}/callback. Socialite checks state (CSRF protection), exchanges the code for an access token server-to-server and reads the profile: a stable id (Google sub, GitHub numeric id, Microsoft object id), the e-mail, name, handle and avatar. The provider's token is used for that single request and then thrown away: Checkin stores no provider token.
  4. Checkin looks up social_accounts by (provider, provider id). The e-mail is not the key: people change addresses, and an e-mail match is only used in the optional case described in link by e-mail.
  5. No connected person → back to /login with "No account is connected to this Google account…", and a Failed sign-in row in the audit log. No account is created, whatever CHECKIN_REGISTRATION says.
  6. Connected person with TOTP enabled → the same hand-off Fortify uses after a correct password: login.id goes in the session and the person lands on /two-factor-challenge. The code (or a recovery code) completes the sign-in.
  7. Otherwise → Auth::login(), session id regenerated, and Fortify's LoginResponse sends the person to the intended URL: when they came from an application, that is /oauth/authorize?…, so the single sign-on continues exactly as after a password sign-in.
  8. The Login event writes the audit log (method: google) and updates last_login_at, which applications receive as auth_time.

From the applications' point of view nothing changes: they still talk OpenID Connect to Checkin, receive the same sub (the person's Checkin UUID) and the same claims. They never learn that the person used Google.

The rules#

RuleWhy
A provider is enabled only when both its client id and secret are setOpt-in, per provider; empty variables = feature invisible, routes answer 404
An external identity never creates a Checkin accountCheckin is invite-only; administrators decide who has an account
An identity signs in only once it is connected to a personExplicit, auditable link between "this Google account" and "this person"
One identity → one person; one identity per provider per personUnique (provider, provider_id) and (user_id, provider) in social_accounts
TOTP still applies after a provider sign-inThe provider replaces the password, not Checkin's second factor
Suspension, access per application, consent: unchangedEnforced at /oauth/authorize for every sign-in method
"Remember me" is not offered for provider sign-insThe session lasts SESSION_LIFETIME; people return through the provider in one click anyway
Profile data (name, e-mail, avatar) is refreshed on each sign-in, only on the connectionThe Checkin profile (what applications see) is never overwritten by a provider
No provider token is storedCheckin only needs to know who signed in, once

Connecting and disconnecting#

By the person (the default way)#

  1. Sign in to Checkin as usual (password or passkey, plus TOTP).
  2. Settings → Security → Connected accounts → Connect next to the provider. Checkin asks to confirm the password if it was not confirmed recently (password.confirm), then goes to the provider and back.
  3. The identity is now connected; from the next sign-in the provider's button works.

If that identity is already connected to someone else, Checkin refuses: "This GitHub account is already connected to another person." Connecting again the same provider with a different identity replaces the previous one.

Disconnect removes the connection immediately. The password, passkeys and TOTP are not touched.

By an administrator#

Administrators cannot connect an identity for someone (they would need that person's Google password), but they can disconnect one from the person's page — for example when the person reports their Google account stolen. Suspending or deleting the person also stops every route in; deleting removes the connections (ON DELETE CASCADE).

With CHECKIN_SOCIAL_LINK_BY_EMAIL=true, the first sign-in with Google or GitHub also connects the identity to the Checkin account with the same e-mail address, when:

  • the provider vouches for the address: Google's email_verified is true; GitHub returns only verified addresses (Socialite asks for the primary verified one);
  • that account has no identity of that provider connected yet.

Microsoft is never matched by e-mail: the address it returns is the user principal name, which any Entra tenant administrator can set to any value, including your users' addresses (the "nOAuth" class of account takeover). Microsoft identities are connected only from Settings → Security.

This option makes invitations smoother (an administrator adds ada@company.com, Ada clicks Google and is in, without ever setting a password) at the price of trusting the provider's e-mail verification for the very first connection. It is off by default; turn it on when your people's addresses live on Google Workspace or GitHub accounts you trust.

Setting up the providers#

The callback URL is always {APP_URL}/auth/{provider}/callback, e.g. https://checkin.example.com/auth/google/callback. Register one per environment (https://checkin.test/... locally).

Google#

  1. Google Cloud Console → create or pick a project → APIs & Services → OAuth consent screen: user type External (any Google account) or Internal (Workspace only — then only your organisation's accounts can use it), app name "Checkin", support e-mail, scopes openid, email, profile.
  2. Credentials → Create credentials → OAuth client ID → Web application.
  3. Authorized redirect URIs: https://checkin.example.com/auth/google/callback.
  4. Copy the client id and secret:
    .env
    GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=GOCSPX-...

An External app in "Testing" status only accepts the test users you list; publish it (no verification is needed for these basic scopes).

GitHub#

  1. GitHub → Settings → Developer settings → OAuth Apps → New OAuth App (under an organisation's settings to own it as the organisation).
  2. Homepage URL: https://checkin.example.com; Authorization callback URL: https://checkin.example.com/auth/github/callback.
  3. Generate a new client secret and copy both values:
    .env
    GITHUB_CLIENT_ID=Ov23li...
    GITHUB_CLIENT_SECRET=...

Socialite asks for the user:email scope (read-only access to the addresses, used to find the verified primary one). A GitHub App works too, but a plain OAuth App is all this needs.

Microsoft (personal, work and school accounts)#

  1. Microsoft Entra admin center → Identity → Applications → App registrations → New registration.
  2. Supported account types: pick who may sign in — this must agree with MICROSOFT_TENANT: | Account types in Entra | MICROSOFT_TENANT | | :--- | :--- | | Accounts in this organizational directory only | your tenant id (recommended for a company) | | Accounts in any organizational directory | organizations | | Any organizational directory and personal Microsoft accounts | common (default) | | Personal Microsoft accounts only | consumers |
  3. Redirect URI: platform Web, https://checkin.example.com/auth/microsoft/callback.
  4. Certificates & secrets → New client secret; copy the Value (not the Secret ID). Note the expiry date: Entra secrets expire (6–24 months) and sign-in with Microsoft stops when they do.
  5. API permissions: User.Read (delegated, present by default) is enough.
    .env
    MICROSOFT_CLIENT_ID=00000000-0000-0000-0000-000000000000   # Application (client) ID
    MICROSOFT_CLIENT_SECRET=...
    MICROSOFT_TENANT=11111111-1111-1111-1111-111111111111      # or common / organizations / consumers

After changing .env in production, run php artisan config:cache.

Configuration#

VariableDefaultRole
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET—Enable "Google" when both are set
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET—Enable "GitHub" when both are set
MICROSOFT_CLIENT_ID / MICROSOFT_CLIENT_SECRET—Enable "Microsoft" when both are set
MICROSOFT_TENANTcommonWhich Microsoft accounts may sign in: a tenant id, organizations, consumers or common
CHECKIN_SOCIAL_LINK_BY_EMAILfalseConnect a Google/GitHub identity to the account with the same verified e-mail on first sign-in

The values live in config/services.php (google, github, microsoft) and config/checkin.php (social.link_by_email). To turn a provider off, empty its id or secret: the button disappears, its routes answer 404, connections stay in the database and work again if you turn it back on. Disconnect people explicitly if you want them gone.

Routes (rate limited to 20 requests per minute per IP, throttle:social):

RouteMiddlewarePurpose
GET /auth/{provider}/redirectguestStart a sign-in
GET /auth/{provider}/linkauth, password.confirmStart connecting the provider to the signed-in account
GET /auth/{provider}/callback—Return from the provider, for both

Security notes#

  • Equivalent to a password, not to a passkey. A Google/GitHub/Microsoft session can be phished like a password can; the provider's own 2FA helps, but Checkin cannot see whether it was used. Checkin's TOTP is therefore still asked. Passkeys remain the strongest option.
  • The OIDC amr claim is unchanged. It describes the methods set up on the account (pwd, otp, hwk), not the method used for this sign-in; applications that need to know exactly how someone signed in should not rely on it.
  • State and CSRF. The state parameter is checked on every callback; a missing or reused one ends at the login page with "The Google sign-in expired".
  • Provider e-mail trust. Only Google (email_verified) and GitHub (verified addresses) are trusted, and only with CHECKIN_SOCIAL_LINK_BY_EMAIL=true. Microsoft never is.
  • Restrict who may even try. Google Internal consent screen or Microsoft single-tenant registration keep strangers away before they reach Checkin; with a plain common/External setup, anyone can authenticate at the provider but still finds no connected account.
  • Secrets. Client secrets are server-side only. Rotate them at the provider and update .env; Microsoft secrets expire on their own.
  • Leaving. Removing someone from Google Workspace / Entra blocks that route in, not the others. Suspend the person in Checkin to lock them out everywhere.

Audit log#

EventContext
Signed inmethod: google, github or microsoft (also when the sign-in completes at the two-factor challenge)
Failed sign-inmethod: the provider, reason: not_connected; email: the address the provider returned
Account connectedprovider; by: email when connected by link by e-mail
Account disconnectedprovider; by: the administrator's e-mail when an administrator did it

Troubleshooting#

SymptomCause / fix
No button on the login pageId or secret missing; php artisan config:clear (or config:cache in production) after editing .env
Google redirect_uri_mismatch, Microsoft AADSTS50011, GitHub "redirect_uri is not associated"The callback registered at the provider must be exactly APP_URL/auth/{provider}/callback, same scheme and host
"The … sign-in expired"The session cookie did not survive the round trip: check APP_URL, SESSION_DOMAIN, SESSION_SECURE_COOKIE (HTTPS), and that the browser was not switched between the two halves
"No account is connected to this … account"Expected for unknown identities: the person signs in another way and connects the provider from Settings → Security (or turn on link by e-mail for Google/GitHub)
Microsoft AADSTS50020 / AADSTS50194MICROSOFT_TENANT does not match the Supported account types of the app registration
Microsoft stopped working after monthsThe client secret expired: create a new one in Entra

Where the code lives#

FileRole
app/Enums/SocialProvider.phpThe three providers, isEnabled(), which e-mail each one vouches for
app/Http/Controllers/Auth/SocialLoginController.phpRedirect, connect, callback: sign-in, two-factor hand-off, connection
app/Models/SocialAccount.php + social_accounts tableConnected identities (no tokens)
routes/web.phpThe three routes, throttle:social
app/Providers/AppServiceProvider.phpThe Microsoft driver (SocialiteWasCalled), the social rate limiter
app/Listeners/AccessLogSubscriber.phpmethod of the Signed in row
resources/views/components/social-login.blade.php, social-icon.blade.phpLogin buttons and brand icons
resources/views/pages/settings/⚡security.blade.phpConnected accounts for the person
resources/views/pages/admin/⚡user-form.blade.phpConnected accounts for administrators
tests/Feature/Auth/SocialLoginTest.phpThe behaviour above, with Socialite mocked

To add another provider (GitLab, Apple, Keycloak…): add a case to SocialProvider (label, e-mail trust — false unless the provider states verification), its block in config/services.php, an icon in social-icon.blade.php, and, for a SocialiteProviders package, its SocialiteWasCalled listener in AppServiceProvider.