Skip to content

Commit a89a01b

Browse files
committed
chore: Updated readme to provide information on generating IAM access token
1 parent 928d95e commit a89a01b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,20 @@ If you'd prefer to set authentication values manually in your code, the SDK supp
137137

138138
### IAM
139139

140-
IBM Cloud is migrating to token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated.
140+
IBM Cloud has migrated to token-based Identity and Access Management (IAM) authentication. IAM authentication uses a service API key to get an access token that is passed with the call. Access tokens are valid for approximately one hour and must be regenerated.
141141

142142
You supply either an IAM service **API key** or an **access token**:
143143

144144
- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
145145
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://console.bluemix.net/docs/services/watson/getting-started-iam.html).
146+
- For untrusted environments use a server-side token generator to generate access tokens for your environment using your IAM API key. The generated access tokens will be valid for one hour and can be refreshed.
147+
148+
### Generating access tokens using IAM API key
149+
```python
150+
# In your API endpoint use this to generate new access tokens
151+
iamTokenManager = IAMTokenManager(iam_apikey='<apikey>')
152+
token = iamTokenManager.get_token()
153+
```
146154

147155
#### Supplying the IAM API key
148156

0 commit comments

Comments
 (0)