Skip to content

Commit

Permalink
Reording auth section code samples
Browse files Browse the repository at this point in the history
  • Loading branch information
cpluta committed Jan 31, 2020
1 parent c50ae97 commit fdfcd1b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 45 deletions.
36 changes: 18 additions & 18 deletions docs/authorization/generating_token.rst
Expand Up @@ -13,13 +13,22 @@ Generating Token
Create a short lived access token to be used for authorized API calls. Typically a token will last 3600 seconds(one hour).

.. tabs::

.. group-tab:: REST

.. group-tab:: C#

.. code-block:: c#
.. code-block:: http
POST https://auth.meshydb.com/{accountName}/connect/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = client.LoginWithPassword(username, password);
client_id={publicKey}&
grant_type=password&
username={username}&
password={password}&
scope=meshy.api offline_access
(Form-encoding removed, and line breaks added for readability)

|parameters|

Expand Down Expand Up @@ -51,21 +60,12 @@ Create a short lived access token to be used for authorized API calls. Typically
password : :type:`string`, :required:`required`
User secret credentials for login. When anonymous it is static as nopassword.

.. group-tab:: REST
.. group-tab:: C#

.. code-block:: http
POST https://auth.meshydb.com/{accountName}/connect/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
client_id={publicKey}&
grant_type=password&
username={username}&
password={password}&
scope=meshy.api offline_access
.. code-block:: c#
(Form-encoding removed, and line breaks added for readability)
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = client.LoginWithPassword(username, password);
|parameters|

Expand Down
47 changes: 24 additions & 23 deletions docs/authorization/refreshing_token.rst
Expand Up @@ -16,29 +16,29 @@ Once the token expires the refresh token can be used to generate a new set of cr

.. tabs::

.. group-tab:: C#
.. group-tab:: REST

.. code-block:: c#
.. code-block:: http
POST https://auth.meshydb.com/{accountName}/connect/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
client_id={publicKey}&
grant_type=refresh_token&
refresh_token={refresh_token}
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = client.LoginWithPassword(username, password);
var refreshToken = connection.RetrieveRefreshToken();
connection = await client.LoginWithRefreshAsync(refreshToken);
(Form-encoding removed, and line breaks added for readability)

|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
username : :type:`string`, :required:`required`
Unique user name for authentication.
password : :type:`string`, :required:`required`
User secret credentials for login. When anonymous it is static as nopassword.
refreshToken : :type:`string`, :required:`required`
refresh_token : :type:`string`, :required:`required`
Refresh token generated from previous access token generation.

.. group-tab:: NodeJS

.. code-block:: javascript
Expand All @@ -64,27 +64,28 @@ Once the token expires the refresh token can be used to generate a new set of cr
refreshToken : :type:`string`, :required:`required`
Refresh token generated from previous access token generation.

.. group-tab:: REST

.. group-tab:: C#

.. code-block:: http
POST https://auth.meshydb.com/{accountName}/connect/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
client_id={publicKey}&
grant_type=refresh_token&
refresh_token={refresh_token}
.. code-block:: c#
var client = MeshyClient.Initialize(accountName, publicKey);
var connection = client.LoginWithPassword(username, password);
var refreshToken = connection.RetrieveRefreshToken();
(Form-encoding removed, and line breaks added for readability)
connection = await client.LoginWithRefreshAsync(refreshToken);
|parameters|

accountName : :type:`string`, :required:`required`
Indicates which account you are connecting to.
publicKey : :type:`string`, :required:`required`
Public identifier of connecting service.
refresh_token : :type:`string`, :required:`required`
username : :type:`string`, :required:`required`
Unique user name for authentication.
password : :type:`string`, :required:`required`
User secret credentials for login. When anonymous it is static as nopassword.
refreshToken : :type:`string`, :required:`required`
Refresh token generated from previous access token generation.

.. rubric:: Responses
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Expand Up @@ -31,18 +31,18 @@ Next Steps

Now that you have your public key, you can begin with any of our language specific quick starts:

* `C# <https://docs.meshydb.com/en/latest/intro/getting_started_csharp.html#install-sdk>`_
* `NodeJS <https://docs.meshydb.com/en/latest/intro/getting_started_nodejs.html#install-sdk>`_
* `REST <https://docs.meshydb.com/en/latest/intro/getting_started_rest.html#registering-anonymous-user>`_
* `NodeJS <https://docs.meshydb.com/en/latest/intro/getting_started_nodejs.html#install-sdk>`_
* `C# <https://docs.meshydb.com/en/latest/intro/getting_started_csharp.html#install-sdk>`_

.. toctree::
:maxdepth: 1
:hidden:
:caption: Getting Started

intro/getting_started_csharp
intro/getting_started_nodejs
intro/getting_started_rest
intro/getting_started_nodejs
intro/getting_started_csharp

.. toctree::
:maxdepth: 2
Expand Down

0 comments on commit fdfcd1b

Please sign in to comment.