samedi 5 mai 2018

youtube authorization credentials for java server application

Pls I need your assistance, i have been having problem uploading videos to youtube especially obtaining authorization credentials for a java server app. The examples presented by google such as this snippet below is for a standalone app, pls anyone body with any link or explanation for a server app should assist me pls.

       public static Credential authorize() throws IOException {
         // Load client secrets.
       InputStream in =
        Quickstart.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");
    return credential;

Aucun commentaire:

Enregistrer un commentaire