Content-Length: 227090 | pFad | https://github.com/twilio/twilio-java/blob/main/examples/BearerTokenAuthentication.md

6E twilio-java/examples/BearerTokenAuthentication.md at main · twilio/twilio-java · GitHub
Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 1.15 KB

BearerTokenAuthentication.md

File metadata and controls

26 lines (21 loc) · 1.15 KB
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);
    }
}








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/twilio/twilio-java/blob/main/examples/BearerTokenAuthentication.md

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy