All files / realm/blong-access/gateway/access accessGoogleGet.ts

100% Statements 25/25
100% Branches 2/2
100% Functions 1/1
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x  
import {validation} from '@feasibleone/blong';
 
/**
 * Public RPC endpoint returning the client-safe Google OAuth config
 * (provider base URL, resolved authorization endpoint, client id).
 *
 * `auth: false` — no session token needed; the gateway serves it as plain
 * JSON-RPC (no MLE), so the browser can fetch it with a plain `fetch()` before
 * login.  Consumed by the blong-browser `authGoogleRedirect` orchestrator.
 */
export default validation(
    async ({lib: {type}}) =>
        function accessGoogleGet() {
            return {
                auth: false,
                params: type.Object({}),
                result: type.Object({
                    baseUrl: type.String(),
                    authorizationEndpoint: type.String(),
                    clientId: type.String(),
                    redirectUri: type.Union([type.String(), type.Null()]),
                }),
            };
        },
);