Skip to content

Commit 10ea7fa

Browse files
authored
Merge pull request #555 from watson-developer-cloud/feature-update-readme
Added missing bracket
2 parents f17eed7 + 663ff04 commit 10ea7fa

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Ensure that you have the following prerequisites:
3535
* If using Unity 2018.2 or later you'll need to set **Scripting Runtime Version** and **Api Compatibility Level** in Build Settings to **.NET 4.x equivalent**. We need to access security options to enable TLS 1.2.
3636

3737
## Getting the Watson SDK and adding it to Unity
38-
You can get the latest SDK release by clicking [here][latest_release_sdk]. You will also need to download the latest release of the IBM Unity SDK Core by clicking [here][latest_release_core]
38+
You can get the latest SDK release by clicking [here][latest_release_sdk]. **You will also need to download the latest release of the IBM Unity SDK Core by clicking [here][latest_release_core].**
3939

4040
### Installing the SDK source into your Unity project
4141
Move the **`unity-sdk`** and **`unity-sdk-core`** directories into the **`Assets`** directory of your Unity project. _Optional: rename the SDK directory from `unity-sdk` to `Watson` and the Core directory from `unity-sdk-core` to `IBMSdkCore`_.
@@ -185,6 +185,50 @@ void UsernamePasswordExample()
185185
}
186186
```
187187

188+
### Supplying credentials
189+
190+
There are two ways to supply the credentials you found above to the SDK for authentication.
191+
192+
#### Credential file (easier!)
193+
194+
With a credential file, you just need to put the file in the right place and the SDK will do the work of parsing it and authenticating. You can get this file by clicking the **Download** button for the credentials in the **Manage** tab of your service instance.
195+
196+
The file downloaded will be called `ibm-credentials.env`. This is the name the SDK will search for and **must** be preserved unless you want to configure the file path (more on that later). The SDK will look for your `ibm-credentials.env` file in the following places (in order):
197+
198+
- Your system's home directory
199+
- The top-level directory of the project you're using the SDK in
200+
201+
As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following:
202+
203+
```cs
204+
public IEnumerator ExampleAutoService()
205+
{
206+
Assistant assistantService = new Assistant("2019-04-03");
207+
208+
// Wait for authorization token
209+
while (!assistantService.Credentials.HasIamTokenData())
210+
yield return null;
211+
212+
var listWorkspacesResult = assistantService.ListWorkspaces();
213+
}
214+
```
215+
216+
And that's it!
217+
218+
If you're using more than one service at a time in your code and get two different `ibm-credentials.env` files, just put the contents together in one `ibm-credentials.env` file and the SDK will handle assigning credentials to their appropriate services.
219+
220+
If you would like to configure the location/name of your credential file, you can set an environment variable called `IBM_CREDENTIALS_FILE`. **This will take precedence over the locations specified above.** Here's how you can do that:
221+
222+
```bash
223+
export IBM_CREDENTIALS_FILE="<path>"
224+
```
225+
226+
where `<path>` is something like `/home/user/Downloads/<file_name>.env`.
227+
228+
#### Manually
229+
230+
If you'd prefer to set authentication values manually in your code, the SDK supports that as well. The way you'll do this depends on what type of credentials your service instance gives you.
231+
188232
## Callbacks
189233
A success callback is required. You can specify the return type in the callback.
190234
```cs
@@ -434,7 +478,7 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
434478
[wdc]: https://www.ibm.com/watson/developer/
435479
[wdc_unity_sdk]: https://github.com/watson-developer-cloud/unity-sdk
436480
[latest_release_sdk]: https://github.com/watson-developer-cloud/unity-sdk/releases/latest
437-
[latest_release_core: https://github.com/IBM/unity-sdk-core/releases/latest
481+
[latest_release_core]: https://github.com/IBM/unity-sdk-core/releases/latest
438482
[get_unity]: https://unity3d.com/get-unity
439483
[documentation]: https://watson-developer-cloud.github.io/unity-sdk/
440484
[ibm-cloud-onboarding]: http://console.bluemix.net/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Unity

0 commit comments

Comments
 (0)