我想创建一个skype bot,我指的是https://developer.microsoft.com/en-us/skype/bots/docs/api/chat,对于授权,doc指的是https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols-oauth-code /但是不清楚使用skype bot apis的范围.
那么任何人都可以告诉我如何获取授权令牌来进行skype bot rest api调用.
我正在尝试使用drive rest api将文件上传到google驱动器,遵循本教程.
对于授权,功能是:
public static Credential authorize() throws IOException {
// Load client secrets.
InputStream in =
DriveQuickstart.class.getResourceAsStream("client_secret.json");
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(DATA_STORE_FACTORY)
.setAccessType("offline")
.build();
Credential credential = new AuthorizationCodeInstalledApp(
flow, new LocalServerReceiver()).authorize("user");
System.out.println(
"Credentials saved to " + DATA_STORE_DIR.getAbsolutePath());
return credential;
}
Run Code Online (Sandbox Code Playgroud)
我获取驱动器中所有文件的功能完全正常.
private static void listFiles(Drive service) throws IOException
{
// Print the names and IDs …Run Code Online (Sandbox Code Playgroud)