Hello. I'm trying to using <api-client-tiger> for ...
# gooddata-cloud
y
Hello. I'm trying to using api-client-tiger for fetching GoodData data with Node.js server. Now I'm using GoodData Cloud with OIDC Auth0 authentication. and I want to move GoodData data fetching logic into Node.js server using api-client-tiger instead of @gooddata/sdk-backend-tiger(React browser environment). [Question] How can I get Get a single execution result using OIDC token?(in Auth0 OIDC flow) instead of Personal Access Tokens? • What should I use for Auth0 OIDC flow with sdk(api-client-tiger) instead of backend and ContextDeferredAuthProvider? [Problem] • Node.js server can't use ContextDeferredAuthProvider and redirectToTigerAuthentication because it depends on window object. • [option] it's not same data retrieveResult and useInsightDataView now
Copy code
import tigerFactory, {
  ContextDeferredAuthProvider,
  redirectToTigerAuthentication,
} from '@gooddata/sdk-backend-tiger'

const backend = tigerFactory()
  .onHostname(process.env.NEXT_PUBLIC_GOODDATA_CLOUD_HOSTING_URL)
  .withAuthentication(
    new ContextDeferredAuthProvider(redirectToTigerAuthentication)
  )

// @see <https://sdk.gooddata.com/gooddata-ui-apidocs/v8.12.0/docs/sdk-ui.useinsightdataview.html#__docusaurus>
  const {
    result,
  } = useInsightDataView(
    {
      insight: idRef(insightIdentifier),
      executeByReference: true,
      filters,
      sorts,
    },
    [insightId]
  )
want
Copy code
import { newAxios, tigerClientFactory } from '@gooddata/api-client-tiger'
cosnt sdk = tigerClientFactory(newAxios(clientEnv.NEXT_PUBLIC_GOODDATA_CLOUD_HOSTING_URL))

const oidc_token = 'How can I get SPRING_SEC_SECURITY_CONTEXT or other OIDC token from Auth0' // I'm using @auth0/nextjs-auth0

// Get a single execution result 
const response = await sdk.executionResult.retrieveResult(
      {
        workspaceId,
        resultId,
      },
      {
        headers: {
          // Authorization: `Bearer ${token}`, // instead of Personal Access Tokens
          Cookie: `SPRING_SEC_SECURITY_CONTEXT=${oidc_token};`,
        },
        withCredentials: true,
      },
)
j
Hi Yoshimori, thank you for the question, let me double check with the team internally.
May you share more details about your use case? Why would you need to use OIDC flow and tokens for interaction with API with api-client-tiger? I’m afraid that only use of personal access token is supported
y
@Jan Kos Hi Jan! Thank you for your answer and internally team support. I tell you your question.
May you share more details about your use case?
[summary] • I provide a web app to show BI dashboard for several clients. • Each client can only access his workspace data(insights and workspace). ◦ => require OIDC? • Each client has each API access count limitation to not stop all clients access. ◦ => can't use common GOODDATA_API_KEY ? • I want to resolve network waterfall and format GoodData API data to ViewModel ◦ => use Next.js Server Components or Node.js API server [now use case] • [front] Next.js with react-sdk(backend) ◦ following backend document ◦ using @auth0/nextjs-auth0 ◦ using @gooddata/sdk-backend-tiger ◦ using OIDC ? (by redirectToTigerAuthentication) ex.
Copy code
const backend = tigerFactory()
  .onHostname(env.NEXT_PUBLIC_GOODDATA_CLOUD_HOSTING_URL)
  .withAuthentication(
    new ContextDeferredAuthProvider(redirectToTigerAuthentication)
  )
[require] • Each client can only access his workspace data(insights and workspace). ◦ => require OIDC ? • Each client has each API access count limitation to not stop all clients access. ◦ => can't use common GOODDATA_API_KEY ? • resolve network waterfall and format GoodData API data to ViewModel by using Next.js Server Components [want use case] • [Front] Next.js with Server Components ◦ Server Components to resolve waterfall and format api data to ViewModel (only show Data fetching from below api) • [API] Next.js app/api server (Node.js base) or express(Node.js) ◦ promise base api server for • [3rd API] GoodData REST ◦ idea1 (api-client-tiger) ◦ idea2 (tried to use OpenAPI base API) ▪︎ execution result with openapi2aspida and @aspida/fetch • mismatch type (no response data ??) ◦ idea3 (tried to use backend) ▪︎ backend requires window but node.js api does'nt have it.