class BearerTokenAuthenticationExamples { public static void main { private static final String GRANT_TYPE = "grant_type_to_be_used"; private static final String CLIENT_SID = "client_id_of_the_organization"; private static final String CLIENT_SECRET = "client_secret_of_organization"; private static final String ORGANISATION_ID = "id_of_the_organization"; //Getting access token - Method #1 TwilioOrgsTokenAuth.init(GRANT_TYPE, CLIENT_ID, CLIENT_SECRET); //Getting access token - Method #2 //To provide custom token manager implementation //Need not call init method if customer token manager is passed //TwilioOrgsTokenAuth.setTokenManager(new CustomTokenManagerImpl(GRANT_TYPE, CLIENT_ID, CLIENT_SECRET)); fetchAccountDetails(); } private static void fetchAccountDetails() { ResourceSet<Account> accountSet = Account.reader(ORGANISATION_ID).read(); String accountSid = accountSet.iterator().next().getAccountSid(); System.out.println(accountSid); } } <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>pFad - Phonifier reborn</title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> </head> <body> <h1>Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.</h1> <!-- Disclaimer --> <p>Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.</p> <br> <p>Alternative Proxies:</p><p><a href="http://clevelandohioweatherforecast.com/php-proxy/index.php?q=https://raw.githubusercontent.com/twilio/twilio-java/refs/heads/main/examples/BearerTokenAuthentication.md" target="_blank">Alternative Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/index.php?u=https://raw.githubusercontent.com/twilio/twilio-java/refs/heads/main/examples/BearerTokenAuthentication.md" target="_blank">pFad Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/v3index.php?u=https://raw.githubusercontent.com/twilio/twilio-java/refs/heads/main/examples/BearerTokenAuthentication.md" target="_blank">pFad v3 Proxy</a></p><p><a href="http://clevelandohioweatherforecast.com/pFad/v4index.php?u=https://raw.githubusercontent.com/twilio/twilio-java/refs/heads/main/examples/BearerTokenAuthentication.md" target="_blank">pFad v4 Proxy</a></p></body> </html>