Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add forge app as a user in Confluence space creation automatically?

Jayanth
Contributor
June 23, 2025

I have built an app using forge. Also, I have a python script automation for creating space and assign roles to groups in cloud. 

Now, I want to add this app as a user while creating the space in the script. How to add this?

Please provide your insights.

Thanks

1 answer

0 votes
Tim Pettersen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2025

Hi @Jayanth

Your Forge "app user" will be automatically granted permissions to access your new space when the space is created.

There may be a slight delay before the permissions are assigned after the space is created, but you should see your app's name appear in the list of users at Space Settings > Space Access.

Hope this helps!

cheers,

Tim

Jayanth
Contributor
June 23, 2025

Hi @Tim Pettersen

What issue I'm facing is that app is installed in my instance. But when creating space it is not available. So, what I thought was like add the app as user to the space with APP_ARI id. 

I'll add the id in payload and give "read" permission like below

payload = json.dumps({
        "subject": {
            "type": "user",
            "identifier": app_id
        },
        "operation": {
            "key": "read",
            "target": "space"
        }
    })
where app_id is forge APP_ARI. 
So, is this correct way to add an app as user?
Tim Pettersen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2025

Hi again @Jayanth,

If your app has at least one scope declared that allows it to access space content (e.g. read:confluence-content) you really shouldn't need to add the app user to your spaces manually — it should be granted permission automatically after the space is created. 

If you've confirmed that you have an appropriate scope and your app isn't being granted permissions, I would recommend raising a developer support request at https://go.atlassian.com/ECOHELP so that we can help troubleshoot.

To answer your specific question, you can determine the app user's accountId by calling the get current user API using `.asApp()` — please note that your app will have separate account IDs for different app environments. 

cheers,

Tim

Jayanth
Contributor
June 24, 2025

Hi @Tim Pettersen 

Thanks for your message.

Can you guide me how to get the app user id using API calls.

Thanks

Tim Pettersen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 24, 2025

Hi @Jayanth

If you add the `read:confluence-user` scope to your manifest, then add something like:

import api, { route } from "@forge/api"; 

...

const response = await api.asApp().requestConfluence(route`/wiki/rest/api/user/current`, {
headers: {
'Accept': 'application/json' }
});

console.log(`Response: ${response.status} ${response.statusText}`);
console.log(await response.json());

...to a resolver function (or any other function) in your app, it will log the details of your app user when it is invoked.

cheers,

Tim

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events