![JAR search and dependency download from the Maven repository](/logo.png)
com.twilio.sdk.examples.AccessTokenExamples Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio-java-sdk Show documentation
Show all versions of twilio-java-sdk Show documentation
Java helper library for Twilio services
package com.twilio.sdk.examples;
import com.twilio.sdk.auth.AccessToken;
import com.twilio.sdk.auth.IpMessagingGrant;
public class AccessTokenExamples {
// You will need your Account Sid and a SigningKey Sid and Secret
// to generate an Access Token for your SDK endpoint to connect to Twilio.
public static final String ACCOUNT_SID = "account_sid";
public static final String SIGNINGKEY_SID = "signing_sid";
public static final String SIGNINGKEY_SECRET = "signing_secret";
public static void main(String[] args) throws Exception {
AccessToken token =
new AccessToken.Builder(ACCOUNT_SID, SIGNINGKEY_SID, SIGNINGKEY_SECRET)
.grant(new IpMessagingGrant())
.build();
String jwtToken = token.toJWT();
System.out.println("Generated jwt:\n" + jwtToken);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy