Access Hub Api from App

Hello, 

I would like to manage users/teams in my YT app. For this you have to address the Hub Api. To do this from the frontend, I tried this approach:

export function fetchHub(path: string, token: string, method: string = 'GET') {
    const baseUrl = new URL(YTApp.me.avatarUrl).origin

    return fetch(baseUrl + '/hub/api/rest/' + path, {
        method: method,
        credentials: 'omit',
        headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json',
            'Accept': 'application/json',
        }
    })
}

Unfortunately the requests are blocked by CORS. 
Is there a way to communicate with the Hub API from an app?

Kind regards

0
1 comment
Official comment

Hi Moritz. To work with Hub in YouTrack apps, one can use the native fetchHub method. This method is currently available only in widgets that use DASHBOARD_WIDGET and MARKDOWN extension points. For more information, see: Custom Widget API Reference.

Please sign in to leave a comment.