## Instructions for the Daily Motion OAuth2 Command-Line Sample

### Browse Online

- Browse Source, or main file DailyMotionSample.java

### Checkout Instructions

Prerequisites: install Java 6, git, and Maven. You may need to set your `JAVA_HOME`.

Important: after checking out the project, and before compiling and running it, you should edit `OAuth2ClientCredentials.java` to enter the required credentials information. Otherwise, you will get a `400 INVALID_CLIENT` error in your browser. To begin, go to the Dailymotion Developer Profile, click "Create New API Key" and specify "http://127.0.0.1:8080/Callback" as the "Callback URL".

    cd [someDirectory]
    git clone https://github.com/googleapis/google-oauth-java-client.git google-oauth-java-client
    cd google-oauth-java-client/samples/dailymotion-cmdline-sample
    [editor] src/main/java/com/google/api/services/samples/dailymotion/cmdline/OAuth2ClientCredentials.java
    mvn compile
    mvn -q exec:java

### Setup Project in Eclipse

Prerequisites: install Eclipse, the Mercurial plugin, and the Maven plugin.

- Setup Eclipse Preferences
  - Window > Preferences... (or on Mac, Eclipse > Preferences...)
  - Select Maven
    - check on "Download Artifact Sources"
    - check on "Download Artifact JavaDoc"
- Import `dailymotion-cmdline-sample` project
  - File > Import...
  - Select "General > Existing Project into Workspace" and click "Next"
  - Click "Browse" next to "Select root directory", find `[someDirectory]/google-oauth-java-client-samples/dailymotion-cmdline-sample` and click "Next"
  - Click "Finish"
- Run
  - Right-click on project dailymotion-cmdline-sample
  - Run As > Java Application
  - If asked, type "DailyMotionSample" and click OK
  - To enabled logging:
    - Run > Run Configurations...
    - Click on "Java Application > DailyMotionSample"
    - VM arguments: `-Djava.util.logging.config.file=${project_loc}/logging.properties`
    - Click "Run"