From ca4ab4c17e197f34d1860bdf0cc2856e48b05bd3 Mon Sep 17 00:00:00 2001 From: Minnie Liu Date: Thu, 4 Mar 2021 10:16:47 -0800 Subject: [PATCH 1/4] Update Identity Readme --- .../azure-communication-identity/README.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index d642f33efbcf..9da8f99d3d02 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -2,7 +2,7 @@ # Azure Communication Identity Package client library for Python -Azure Communication Identity client package is intended to be used to setup the basics for opening a way to use Azure Communication Service offerings. This package helps to create identities user tokens to be used by other client packages such as chat, calling, sms. +Azure Communication Identity client package is intended to be used to setup the basics for opening a way to use Azure Communication Service offerings. This package helps to create identities user tokens to be used by other client packages such as chat, calling, sms. [Source code](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity) | [Package (Pypi)](https://pypi.org/project/azure-communication-identity/) | [API reference documentation](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity) | [Product documentation](https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-python) @@ -51,21 +51,12 @@ The following section provides several code snippets covering some of the most c ### Creating a new user -Use the `create_user` method to create a new user. +Use the `create_user` method to create a new user. ```python user = identity_client.create_user() print("User created with id:" + user.identifier) ``` -Alternatively, use the `create_user_and_token` method to create a new user and issue a token for it.\ -For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information) - -```python -user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) -print("User id:" + user.identifier) -print("Token issued with value: " + tokenresponse.token) -``` - ### Issuing or Refreshing an access token for a user Use the `get_token` method to issue or refresh a scoped access token for the user. \ @@ -78,6 +69,16 @@ tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope. print("Token issued with value: " + tokenresponse.token) ``` +### Creating a user and a token in a single request + +For convenience, use `create_user_and_token` to create a new user and issue a token with one function call. This translates into a single web request as opposed to creating a user first and then issuing a token. + +```python +user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) +print("User id:" + user.identifier) +print("Token issued with value: " + tokenresponse.token) +``` + ### Revoking a user's access tokens Use `revoke_tokens` to revoke all access tokens for a user. Pass in the user object as a parameter From 03564e10891113643870fff519b7bc9f094dd449 Mon Sep 17 00:00:00 2001 From: Minnie Liu Date: Thu, 4 Mar 2021 10:17:35 -0800 Subject: [PATCH 2/4] Revert Readme --- .../azure-communication-identity/README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index 9da8f99d3d02..734d8b1cf194 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -57,6 +57,15 @@ user = identity_client.create_user() print("User created with id:" + user.identifier) ``` +Alternatively, use the `create_user_and_token` method to create a new user and issue a token for it.\ +For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information) + +```python +user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) +print("User id:" + user.identifier) +print("Token issued with value: " + tokenresponse.token) +``` + ### Issuing or Refreshing an access token for a user Use the `get_token` method to issue or refresh a scoped access token for the user. \ @@ -69,16 +78,6 @@ tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope. print("Token issued with value: " + tokenresponse.token) ``` -### Creating a user and a token in a single request - -For convenience, use `create_user_and_token` to create a new user and issue a token with one function call. This translates into a single web request as opposed to creating a user first and then issuing a token. - -```python -user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) -print("User id:" + user.identifier) -print("Token issued with value: " + tokenresponse.token) -``` - ### Revoking a user's access tokens Use `revoke_tokens` to revoke all access tokens for a user. Pass in the user object as a parameter From 7285b33e2e88b9493503c96d1d66d349a7925635 Mon Sep 17 00:00:00 2001 From: Minnie Liu Date: Thu, 4 Mar 2021 10:18:38 -0800 Subject: [PATCH 3/4] Update Identity Readme --- .../azure-communication-identity/README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index 734d8b1cf194..dd2d0ab7909a 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -57,15 +57,6 @@ user = identity_client.create_user() print("User created with id:" + user.identifier) ``` -Alternatively, use the `create_user_and_token` method to create a new user and issue a token for it.\ -For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information) - -```python -user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) -print("User id:" + user.identifier) -print("Token issued with value: " + tokenresponse.token) -``` - ### Issuing or Refreshing an access token for a user Use the `get_token` method to issue or refresh a scoped access token for the user. \ @@ -77,6 +68,14 @@ Pass in the user object as a parameter, and a list of `CommunicationTokenScope`. tokenresponse = identity_client.get_token(user, scopes=[CommunicationTokenScope.CHAT]) print("Token issued with value: " + tokenresponse.token) ``` +### Creating a user and a token in a single request +For convenience, use `create_user_and_token` to create a new user and issue a token with one function call. This translates into a single web request as opposed to creating a user first and then issuing a token. + +```python +user, tokenresponse = identity_client.create_user_and_token(scopes=[CommunicationTokenScope.CHAT]) +print("User id:" + user.identifier) +print("Token issued with value: " + tokenresponse.token) +``` ### Revoking a user's access tokens From 048eb7399c29c2ed67befa930f11413776cc5b9e Mon Sep 17 00:00:00 2001 From: Minnie Liu Date: Thu, 4 Mar 2021 11:41:50 -0800 Subject: [PATCH 4/4] Address reviews --- sdk/communication/azure-communication-identity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index dd2d0ab7909a..2b052765b6f4 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -2,7 +2,7 @@ # Azure Communication Identity Package client library for Python -Azure Communication Identity client package is intended to be used to setup the basics for opening a way to use Azure Communication Service offerings. This package helps to create identities user tokens to be used by other client packages such as chat, calling, sms. +Azure Communication Identity client package is intended to be used to setup the basics for opening a way to use Azure Communication Service offerings. This package helps to create identity user tokens to be used by other client packages such as chat, calling, sms. [Source code](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity) | [Package (Pypi)](https://pypi.org/project/azure-communication-identity/) | [API reference documentation](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity) | [Product documentation](https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-python)