Skip to content

Commit

Permalink
docs: Update authentication docs (box/box-codegen#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build committed Jan 24, 2025
1 parent 2d324ab commit a559795
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "6582211", "specHash": "3dc3f1e", "version": "1.6.0" }
{ "engineHash": "038fca8", "specHash": "3dc3f1e", "version": "1.6.0" }
24 changes: 24 additions & 0 deletions docs/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
- [Obtaining User token](#obtaining-user-token)
- [Switching between Service Account and User](#switching-between-service-account-and-user)
- [OAuth 2.0 Auth](#oauth-20-auth)
- [Retrieve current access token](#retrieve-current-access-token)
- [Refresh access token](#refresh-access-token)
- [Revoke token](#revoke-token)
- [Downscope token](#downscope-token)
- [Token storage](#token-storage)
Expand Down Expand Up @@ -245,6 +247,28 @@ You need to provide the auth code to the SDK to obtain an access token, then you
await auth.GetTokensAuthorizationCodeGrantAsync("code");
```

# Retrieve current access token

After initializing the authentication object, the SDK will able to retrieve the access token.
To retrieve the current access token you can use the following code:

<!-- sample post_oauth2_token -->

```c#
await auth.RetrieveTokenAsync();
```

# Refresh access token

Access tokens are short-lived and need to be refreshed periodically. The SDK will automatically refresh the token when needed.
If you want to manually refresh the token, you can use the following code:

<!-- sample post_oauth2_token refresh -->

```c#
await auth.RefreshTokenAsync();
```

# Revoke token

Access tokens for a client can be revoked when needed. This call invalidates old token.
Expand Down

0 comments on commit a559795

Please sign in to comment.