Skip to Content
0
Jan 10, 2023 at 11:29 AM

How to get access_token for SAP BTP global account

558 Views Last edit Jan 10, 2023 at 01:54 PM 2 rev

Hello,

I'm using the following code example to get `access_token` for SAP BTP

    private static final String USERNAME = "<YOUR_USERNAME>";<br>    private static final String PASSWORD = "<YOUR_PASSWORD>";<br>    private static final String TOKEN_ENDPOINT = "https://<YOUR_BTP_TENANT>.authentication.sap.hana.ondemand.com/oauth/token";<br>    private static final String GRANT_TYPE = "password";<br>    public static void main(String[] args) throws IOException, InterruptedException {<br>        HttpClient client = HttpClient.newBuilder().build();<br>        String requestBody = String.format("grant_type=%s&username=%s&password=%s",<br>                GRANT_TYPE, USERNAME, PASSWORD);<br>        HttpRequest request = HttpRequest.newBuilder()<br>                .POST(HttpRequest.BodyPublishers.ofString(requestBody))<br>                .uri(URI.create(TOKEN_ENDPOINT))<br>                .setHeader("Content-Type", "application/x-www-form-urlencoded")<br>                .build();

Could you help me to get <YOUR_BTP_TENANT> id for the global account, not for subaccounts?

MyCompanyLLC from the screenshot is doesn't work

image.png

Attachments

image.png (89.1 kB)