You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+25-43Lines changed: 25 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,61 +23,43 @@ sure to read and agree with the license.
23
23
24
24
## Setting up Test Credentials
25
25
26
-
The tests require two credentials to run:
26
+
The tests require at least two credentials to run:
27
27
28
-
-`TEST_CLIENT_ID`: Your Trakt API client ID
29
-
-`TEST_ACCESS_TOKEN`: Your Trakt API access token
28
+
-`TEST_CLIENT_ID`: A Trakt API client ID
29
+
-`TEST_ACCESS_TOKEN`: A Trakt API access token
30
30
31
-
### Option 1: Environment Variables (Recommended for CI/CD)
31
+
They can be set either
32
32
33
-
Set environment variables in your shell:
33
+
- in a `secrets.properties` file (a template is available in [secrets.properties.template](secrets.properties.template))
34
+
- or as environment variables.
34
35
35
-
**Windows (PowerShell):**
36
-
37
-
```powershell
38
-
$env:TEST_CLIENT_ID="your_client_id_here"
39
-
$env:TEST_ACCESS_TOKEN="your_access_token_here"
40
-
```
41
-
42
-
**Linux/Mac:**
43
-
44
-
```bash
45
-
export TEST_CLIENT_ID="your_client_id_here"
46
-
export TEST_ACCESS_TOKEN="your_access_token_here"
47
-
```
48
-
49
-
### Option 2: secrets.properties File (Recommended for Local Development)
50
-
51
-
1. Copy the sample file:
52
-
53
-
```
54
-
cp secrets.properties.sample secrets.properties
55
-
```
56
-
57
-
2. Edit `secrets.properties` and add your credentials:
36
+
If both are set, environment variables take precedence over the properties file.
58
37
59
-
```properties
60
-
TEST_CLIENT_ID=your_client_id_here
61
-
TEST_ACCESS_TOKEN=your_access_token_here
62
-
```
38
+
### Getting Credentials
63
39
64
-
3. The `secrets.properties` file is automatically ignored by git and will not be committed.
40
+
To obtain Trakt API credentials:
65
41
66
-
### Priority
42
+
1. Create a Trakt account at https://trakt.tv (⚠️ Tests do modify data of the Trakt account, don't use your personal account!)
43
+
2. Register an application at https://trakt.tv/oauth/applications
44
+
3. Copy the Client ID and set it as `TEST_CLIENT_ID`
45
+
4. Copy the Client Secret and set it as `TEST_CLIENT_SECRET`
46
+
5. Add `http://localhost` to the Redirect URIs
47
+
6. Click the "Authorize" button next to the localhost redirect URI and authorize access (alternatively, run `test_getAuthorizationRequest()` in [AuthTest][] and visit the URL it prints)
48
+
7. Extract the value of `code` from the redirect URI and set it as `TEST_AUTH_CODE`
49
+
8. Run `test_getAccessToken()` in [AuthTest][]
50
+
9. Copy the printed access and refresh token and set them as `TEST_ACCESS_TOKEN` and `TEST_REFRESH_TOKEN`
67
51
68
-
If both are set, environment variables take precedence over the properties file.
52
+
### Refreshing the Access Token
69
53
70
-
### Getting Credentials
54
+
If `TEST_ACCESS_TOKEN` is expired, but `TEST_REFRESH_TOKEN` isn't:
71
55
72
-
To obtain your Trakt API credentials:
56
+
1. Run `test_refreshAccessToken()` in [AuthTest][]
57
+
2. Copy the printed access and refresh token and set them as `TEST_ACCESS_TOKEN` and `TEST_REFRESH_TOKEN`
73
58
74
-
1. Create a Trakt account at https://trakt.tv
75
-
2. Register your application at https://trakt.tv/oauth/applications
76
-
3. Use the provided Client ID and generate an access token.
77
-
For example, add the `http://localhost` URI and use the "Authorize" button on the Trakt API apps website.
78
-
Then use the `code` in the redirect URL to obtain an access token using `AuthTest.test_getAccessToken` (set client
79
-
secret and code first).
59
+
Otherwise, repeat steps 6 and following from above.
80
60
81
61
## No code!
82
62
83
63
You can [discuss or submit bug reports](https://github.com/UweTrottmann/trakt-java/issues)!
0 commit comments