Skip to content

Commit 0af5ac0

Browse files
authored
Update docs for new BE API & links (#45)
This updates the recommended API for credential creation, and generally makes the formatting consistent with other SDK READMEs.
1 parent f9212c3 commit 0af5ac0

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
# SnapAuth TypeScript/JavaScript SDK
22

3-
The official TS/JS SDK for SnapAuth 🫰
3+
This is the official TS/JS SDK for [SnapAuth](https://www.snapauth.app/?utm_source=GitHub&utm_campaign=sdk&utm_content=sdk-typescript).
4+
5+
SnapAuth will let you add passkey support to your web (and native) app in a snap!
6+
Add strong multi-factor authentication or go fully passwordless while maintaining a great, frictionless user experience.
47

58
This is for _client_ code.
69
If you're looking for the _server_ integration, check out [`@snapauth/node-sdk`](https://github.com/snapauthapp/sdk-node).
710

11+
[SnapAuth Homepage](https://www.snapauth.app?utm_source=GitHub&utm_campaign=sdk&utm_content=sdk-typescript)
12+
| [SnapAuth Docs](https://docs.snapauth.app)
13+
| [Dashboard](https://dashboard.snapauth.app)
14+
| [Github](https://github.com/snapauthapp/sdk-typescript)
15+
| [NPM](https://www.npmjs.com/package/@snapauth/sdk)
16+
17+
[![GitHub Release](https://img.shields.io/github/v/release/snapauthapp/sdk-typescript)](https://github.com/snapauthapp/sdk-typescript/releases)
18+
[![Test](https://github.com/snapauthapp/sdk-typescript/actions/workflows/test.yml/badge.svg)](https://github.com/snapauthapp/sdk-typescript/actions/workflows/test.yml)
19+
![GitHub License](https://img.shields.io/github/license/snapauthapp/sdk-typescript)
20+
821
[![NPM Version](https://img.shields.io/npm/v/%40snapauth%2Fsdk)](https://www.npmjs.com/package/@snapauth/sdk)
922
![npm bundle size](https://img.shields.io/bundlephobia/minzip/%40snapauth%2Fsdk)
1023
![NPM Type Definitions](https://img.shields.io/npm/types/%40snapauth%2Fsdk)
11-
![GitHub License](https://img.shields.io/github/license/snapauthapp/sdk-typescript)
1224

13-
- [SnapAuth Homepage](https://www.snapauth.app)
14-
- [Docs](https://docs.snapauth.app)
15-
- [Dashboard](https://dashboard.snapauth.app)
16-
- [Github](https://github.com/snapauthapp/sdk-typescript)
1725

1826
## Installation and Setup
1927
### Node
@@ -53,32 +61,32 @@ Browsers will ignore most WebAuthn requests that are not in response to a user g
5361

5462
```typescript
5563
// Get `name` from a field in your UI, your backend, etc.
56-
// This is what the user will see when authenticating
64+
// This should be what the user signs in with, such as a username or email address
5765
const registration = await snapAuth.startRegister({ name })
5866
if (registration.ok) {
5967
const token = registration.data.token
60-
// Send token to your backend to use the /registration/attach API
68+
// Send token to your backend to use the /credential/create API
6169
} else {
6270
// Inspect registration.error and decide how best to proceed
6371
}
6472
```
6573

6674
> [!IMPORTANT]
67-
> You MUST send the token to the backend [`/registration/attach`](https://docs.snapauth.app/server.html#attach-registration-token) API to associate it with the user.
75+
> You MUST send the token to the backend [`/credential/create`](https://docs.snapauth.app/server.html#create-a-credential) API to associate it with the user.
6876
> Until this is done, the user will not be able to use their new credential.
6977
>
7078
> For security, the token expires in a few minutes.
7179
> The response includes a `expiresAt` field indicating when this needs to be done.
7280
7381
The `name` value is used completely locally, and _is not sent to SnapAuth's servers_.
74-
This is commonly something like a human name, email address, or login handle.
75-
This will be visible to the user when they sign in.
82+
This is should be a login handle such as a username or email address.
83+
84+
You may also set `displayName`, though browsers typically (counter-intuitively) ignore `displayName` in favor of `name`.
7685

7786
> [!WARNING]
7887
> The `name` field cannot be changed at this time - it's not supported by browsers.
7988
> Once browser APIs exist to modify it, we will add support to the SDK.
80-
81-
You may also set `displayName`, though browsers typically (counter-intuitively) ignore `displayName` in favor of `name`.
89+
> See [#40](https://github.com/snapauthapp/sdk-typescript/issues/40) for details.
8290
8391

8492
### Authenticating

0 commit comments

Comments
 (0)