Skip to content

Commit

Permalink
change insight auth in docs (#5681)
Browse files Browse the repository at this point in the history
## Problem solved

https://linear.app/thirdweb/issue/INSIGHT-480/improvements-required-for-insight-playground

Updated the authentication method in the Insight API documentation to use the `x-client-id` header instead of embedding the client ID in the URL path.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the GitHub workflow and documentation related to the `insight` feature. It enhances the valid issue prefixes and provides clearer instructions for authentication in the API usage.

### Detailed summary
- Updated `VALID_ISSUE_PREFIXES` to include `INSIGHT`.
- Improved documentation in `apps/portal/src/app/insight/get-started/page.mdx`:
  - Corrected "clientId" to "client ID".
  - Added a note about using the `x-client-id` header for authentication.
- Modified the API fetch request to include headers for `client ID`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
iuwqyir committed Dec 11, 2024
1 parent a9dd26c commit 3f56252
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, edited]

env:
VALID_ISSUE_PREFIXES: "CNCT|DASH|PROT"
VALID_ISSUE_PREFIXES: "CNCT|DASH|PROT|INSIGHT"

jobs:
linear:
Expand Down
11 changes: 8 additions & 3 deletions apps/portal/src/app/insight/get-started/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ In this guide we will learn how to use the events blueprint in insight.

## Pre-requisites

- [Create a project](https://thirdweb.com/team) and navigate to the project settings to get a clientId
- Use insight API with the base URL below
- [Create a project](https://thirdweb.com/team) and navigate to the project settings to get a client ID
- Use insight API with the base URL below.
- To authenticate use your client ID in the `x-client-id` header or `clientId` query parameter

```
https://<chain-id>.insight.thirdweb.com
Expand All @@ -27,7 +28,11 @@ https://<chain-id>.insight.thirdweb.com
```typescript
const getUsdtTransfers = async () => {
try {
const response = await fetch('https://1.insight.thirdweb.com/v1/<client-id>/events/0xdAC17F958D2ee523a2206206994597C13D831ec7/Transfer(address,address,uint256)?limit=5');
const response = await fetch('https://1.insight.thirdweb.com/v1/events/0xdAC17F958D2ee523a2206206994597C13D831ec7/Transfer(address,address,uint256)?limit=5', {
headers: {
'x-client-id': <YOUR_THIRDWEB_CLIENT_ID>
}
});
const transfersInfo = await response.json();
return transfersInfo
} catch (error) {
Expand Down

0 comments on commit 3f56252

Please sign in to comment.