WaspW
Wasp13mo ago
dozieokk

how to pass through a json response from the server to the client without using react component

how do I pass through a json response from the server to the client without using react component.

Example:

if client is hosted on port 3000 at client.com, and I have an api endpoint hosted on port 3001 which the client is using

API:

api getOauthClientMetadata {
  fn: import { getOauthClientMetadata } from "@src/server/getOauthClientMetadata.ts",
  httpRoute: (GET, "/oauth/client-metadata.json")
}


The API returns the following json:

import { Request, Response } from 'express';

export const getOauthClientMetadata  = async (_req: Request, res: Response) => {
  res.setHeader('Content-Type', 'application/json');
  res.status(200).json({
    application_type: "web",
    client_id: "https://oauth-flask.demo.bsky.dev/oauth/client-metadata.json",
    client_name: "atproto OAuth Flask Backend Demo",
    client_uri: "https://oauth-flask.demo.bsky.dev/",
    dpop_bound_access_tokens: true,
    grant_types: [
    "authorization_code",
    "refresh_token"
    ],
    jwks_uri: "https://oauth-flask.demo.bsky.dev/oauth/jwks.json",
    redirect_uris: [
    "https://oauth-flask.demo.bsky.dev/oauth/callback"
    ],
    response_types: [
    "code"
    ],
    scope: "atproto transition:generic",
    token_endpoint_auth_method: "private_key_jwt",
    token_endpoint_auth_signing_alg: "ES256"
    });
};


how do I access the json from client.com/oauth/client-metadata.json as json
Was this page helpful?