How to use the Parent organization Oauth token to access the Child Organization

How to use the Parent organization Oauth token to access the Child Organization

book

Article ID: KB0070548

calendar_today

Updated On:

Products Versions
TIBCO Cloud -

Description

To access the child organization using the Oauth token from the parent organization enable the below settings -
1. Enable "cross-organization sharing" at the parent organization
2. Enable  "share with parent org" at the child organization.
Doc link: cross-organization sharing

Issue/Introduction

How to use the Parent organization Oauth token to access the Child Organization

Resolution

Assuming the user has access to TIBCO Cloud subscriptions in parent and child organizations. Below are the steps for using OAuth token from the parent organization to access the child organization.
1. Generate an OAuth token in the parent org.
Doc link: Generating Access Tokens
Example: Access token name: Test
Secret access token: *********************** 
scope: TSC TCI

2.  Use the Get UserInfo API to get the subscription locator for all the orgs the user has access to.
API: https://api.cloud.tibco.com/tci/docs/#/User
Curl: 
curl -X 'GET' \
  'https://api.cloud.tibco.com/tci/v1/userinfo' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer CIC~*********************'
 

3. Use the SuscriptionLocator ID of the child org in the required API call 
subscriptionLocator: Enter 0 for the subscription associated with your OAuth token.
Curl 1: will return all the TCI apps in the parent subscription. 
curl -X 'GET' \
  'https://api.cloud.tibco.com/tci/v1/subscriptions/0/apps' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer CIC~****************'

Curl 2: will return all the TCI apps in the child org whose subscriptionLocator is td4aqsqh6hi5qtl-scma7wwlksiznt
curl -X 'GET' \
  'https://api.cloud.tibco.com/tci/v1/subscriptions/td4aqsqh6hi5qtl-scma7wwlksiznt/apps' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer CIC~*******************'