How to query page url value from forge UI KIT

Am trying to query confluence Page URL from forge UI KIT app.
https://mysite.atlassian.net/wiki/spaces/Jackoba/pages/6xxxx/MyPage

I want to get value Jackoba and MyPage from the url

I have tried

const queryParams = new URLSearchParams(window.location.search);

but it throws error
windows not defined

Hey @NkemjikaGwacham

You cannot access the window object in UI kit as the Javascript executes on the server.

While you cannot access the URL directly, you can get the context of an app within a given extension point.

import ForgeUI, { useProductContext, Text, Macro, render } from '@forge/ui';

const App = () => {
  const context = useProductContext();
  return <Text>All info about my context: {JSON.stringify(context)}</Text>;
};

export const run = render(<Macro app={<App />} />);
1 Like

When will it possible. ??
I have that problem too.
My Background:
My App should connect with the “Tempo Timetracking” App.
I just only want to make some call to their API too.

But the Authorization with OAuth2 cant be done, because the Redirect URL has also the code parameter. Which I should send to get an access token.

Hi @AlexanderSchlegel,

Forge apps will never have access to the window object of the product. This would be a security issue.

Can you explain your use case a little more for talking to another app?

Hello Daniel,

im happy to do :slight_smile:
At first I need to setup the Authorization between my App and the Tempo API:
https://apidocs.tempo.io/

I use the OAuth2 Verification. My goal is to send some GET Requests to the Endpoints
/account-links/project/{projectKey} and maybe in the future some more :slight_smile:

ATM I need the default Tempo Account for the Project, because after I clone some Issues, I want to link the Account to the Issue.

My problem is that the normal OAuth2 Flow is not possible with a Forge App.