-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
161 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base", | ||
":combinePatchMinorReleases", | ||
":dependencyDashboard", | ||
":maintainLockFilesWeekly", | ||
":pinAllExceptPeerDependencies", | ||
":prConcurrentLimit10", | ||
":rebaseStalePrs", | ||
":separateMajorReleases", | ||
"group:monorepos", | ||
"schedule:weekends" | ||
], | ||
"enabledManagers": ["cargo", "github-actions", "npm", "nuget"], | ||
"commitMessagePrefix": "[deps]:", | ||
"commitMessageTopic": "{{depName}}", | ||
"packageRules": [ | ||
{ | ||
"groupName": "cargo minor", | ||
"matchManagers": ["cargo"], | ||
"matchUpdateTypes": ["minor", "patch"] | ||
}, | ||
{ | ||
"groupName": "gh minor", | ||
"matchManagers": ["github-actions"], | ||
"matchUpdateTypes": ["minor", "patch"] | ||
}, | ||
{ | ||
"groupName": "npm minor", | ||
"matchManagers": ["npm"], | ||
"matchUpdateTypes": ["minor", "patch"] | ||
}, | ||
{ | ||
"groupName": "nuget minor", | ||
"matchManagers": ["nuget"], | ||
"matchUpdateTypes": ["minor", "patch"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ The request body may include additional parameters besides those required, all o | |
| `discoverable` | If `true`, creates a client-side Discoverable Credential that allows sign in without needing a username. | `true` (default) | | ||
| `userVerification` | Allows choosing preference for requiring User Verification (biometrics, pin code etc) when authenticating Can be `"preferred"` (default), `"required"` or `"discouraged"`. | `"preferred"` | | ||
| `expiresAt` | Timestamp (UTC) when the registration token should expire. By default, current time + 120 seconds. | `"3023-08-01T14:43:03Z"` | | ||
| `aliases` | A array of aliases for the userId, such as an email or username. Used to initiate a signin on the client side with the `signinWithAlias()` method. An alias must be unique to the userId. Defaults to an empty array `[]`. | `["[email protected]"]` | | ||
| `aliases` | A array of aliases for the userId, such as an email or username. Used to initiate a sign-in on the client side with the `signinWithAlias()` method. An alias must be unique to the userId. Defaults to an empty array `[]`. | `["[email protected]"]` | | ||
| `aliasHashing` | Whether aliases should be hashed before being stored. Defaults to `true`. | `true` | | ||
|
||
### Response | ||
|
@@ -86,7 +86,7 @@ This registration token will will be used by your frontend to negotiate creation | |
|
||
### Request | ||
|
||
`POST` requests made to the `/signin` endpoint unpack a [verification token](concepts.md#tokens), which must be generated by calling a `.signinWith*()` method on your frontend ([learn more](frontend/javascript.md#signinwith)) and included here in the request body, for example: | ||
`POST` requests made to the `/signin/verify` endpoint unpack an [authentication token](concepts.md#tokens), which must be generated by calling a `.signinWith*()` method on your frontend ([learn more](frontend/javascript.md#signinwith)) and included here in the request body, for example: | ||
|
||
<CodeSwitcher :languages="{http:'HTTP',js:'JavaScript'}"> | ||
<template v-slot:http> | ||
|
@@ -107,13 +107,13 @@ Content-Type: application/json | |
```js | ||
const apiUrl = 'https://v4.passwordless.dev'; | ||
|
||
// Fetch the verification token from your frontend. | ||
const token = { token: req.query.token }; | ||
// Fetch the authentication token from your frontend. | ||
const payload = { token: req.query.token }; | ||
|
||
// POST the verification token to the Passwordless.dev API using your API private secret. | ||
// POST the authentication token to the Passwordless.dev API using your API private secret. | ||
const response = await fetch(apiUrl + '/signin/verify', { | ||
method: 'POST', | ||
body: JSON.stringify({ token }), | ||
body: JSON.stringify(payload), | ||
headers: { | ||
'ApiSecret': 'myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4', | ||
'Content-Type': 'application/json' | ||
|
@@ -124,7 +124,7 @@ const response = await fetch(apiUrl + '/signin/verify', { | |
</template> | ||
</CodeSwitcher> | ||
|
||
The Passwordless.dev private API will unpack the verification token to check its legitimacy. | ||
The Passwordless.dev private API will unpack the authentication token to check its legitimacy. | ||
|
||
### Response | ||
|
||
|
@@ -148,6 +148,60 @@ If successful, the `/signin/verify` endpoint will return a success response obje | |
|
||
Use the `.success` value (`true` or `false`) to determine next actions, i.e. whether to complete the sign-in ([learn more](frontend/javascript.md#signinwith)). | ||
|
||
## /signin/generate-token | ||
|
||
### Request | ||
|
||
`POST` requests made to the `/signin/generate-token` endpoint create a [manually generated authentication token](concepts.md#tokens) for a user, side-stepping the regular sign-in flow (i.e. the `.signinWith*()` methods). The resulting token can then be verified through the `/signin/verify` endpoint and used just like a regular authentication token. | ||
|
||
<CodeSwitcher :languages="{http:'HTTP',js:'JavaScript'}"> | ||
<template v-slot:http> | ||
|
||
```http | ||
POST https://v4.passwordless.dev/signin/generate-token HTTP/1.1 | ||
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4 | ||
Content-Type: application/json | ||
{ | ||
"userId": "123" | ||
} | ||
``` | ||
|
||
</template> | ||
<template v-slot:js> | ||
|
||
```js | ||
const apiUrl = 'https://v4.passwordless.dev'; | ||
|
||
// Generate an authentication token, side-stepping the usual signin process. | ||
const payload = { | ||
userId: '107fb578-9559-4540-a0e2-f82ad78852f7' | ||
}; | ||
|
||
// POST the user ID to the Passwordless.dev API using your API private secret. | ||
const response = await fetch(apiUrl + '/signin/generate-token', { | ||
method: 'POST', | ||
body: JSON.stringify(payload), | ||
headers: { | ||
'ApiSecret': 'myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4', | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
``` | ||
|
||
</template> | ||
</CodeSwitcher> | ||
|
||
### Response | ||
|
||
If successful, the `/signin/generate-token` endpoint will return a response object, for example: | ||
|
||
```json | ||
{ | ||
"token": "d5vzCkL_GvpS4VYtoT3..." | ||
} | ||
``` | ||
|
||
## /alias | ||
|
||
### Request | ||
|
@@ -164,7 +218,14 @@ POST https://v4.passwordless.dev/alias HTTP/1.1 | |
ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4 | ||
Content-Type: application/json | ||
{ "userId": "107fb578-9559-4540-a0e2-f82ad78852f7", "aliases": ["[email protected]", "[email protected]"], "hashing": true } | ||
{ | ||
"userId": "107fb578-9559-4540-a0e2-f82ad78852f7", | ||
"aliases": [ | ||
"[email protected]", | ||
"[email protected]" | ||
], | ||
"hashing": true | ||
} | ||
``` | ||
|
||
</template> | ||
|
@@ -253,25 +314,24 @@ If successful, the `/credentials/list` endpoint will return an array of `.json` | |
|
||
```json | ||
[ | ||
{ | ||
"descriptor": { | ||
"type": "public-key", | ||
"id": "2mgrJ6LPItfxbnVc2UgFPHowNGKaYBm3Pf4so1bsXSk" | ||
}, | ||
"publicKey": "pQECAyYgASFYIPi4M0A+ZFeyOHEC9iMe6dVhFnmOZdgac3MRmfqVpZ0AIlggWZ+l6+5rOGckXAsJ8i+mvPm4YuRQYDTHiJhIauagX4Q=", | ||
"userHandle": "YzhhMzJlNWItNDZkMy00ODA4LWFlMTAtMTZkM2UyNmZmNmY5", | ||
"signatureCounter": 0, | ||
"createdAt": "2023-04-21T13:33:50.0764103", | ||
"aaGuid": "adce0002-35bc-c60a-648b-0b25f1f05503", | ||
"lastUsedAt": "2023-04-21T13:33:50.0764103", | ||
"rpid": "myapp.example.com", | ||
"origin": "https://myapp.example.com", | ||
"country": "US", | ||
"device": "Chrome, Mac OS X 10", | ||
"nickname": "Fred's Macbook Pro 2", | ||
"userId": "c8a32e5b-46d3-4808-ae10-16d3e26ff6f9" | ||
{ | ||
"descriptor": { | ||
"type": "public-key", | ||
"id": "2mgrJ6LPItfxbnVc2UgFPHowNGKaYBm3Pf4so1bsXSk" | ||
}, | ||
... | ||
"publicKey": "pQECAyYgASFYIPi4M0A+ZFeyOHEC9iMe6dVhFnmOZdgac3MRmfqVpZ0AIlggWZ+l6+5rOGckXAsJ8i+mvPm4YuRQYDTHiJhIauagX4Q=", | ||
"userHandle": "YzhhMzJlNWItNDZkMy00ODA4LWFlMTAtMTZkM2UyNmZmNmY5", | ||
"signatureCounter": 0, | ||
"createdAt": "2023-04-21T13:33:50.0764103", | ||
"aaGuid": "adce0002-35bc-c60a-648b-0b25f1f05503", | ||
"lastUsedAt": "2023-04-21T13:33:50.0764103", | ||
"rpid": "myapp.example.com", | ||
"origin": "https://myapp.example.com", | ||
"country": "US", | ||
"device": "Chrome, Mac OS X 10", | ||
"nickname": "Fred's Macbook Pro 2", | ||
"userId": "c8a32e5b-46d3-4808-ae10-16d3e26ff6f9" | ||
} //, ... | ||
] | ||
``` | ||
|
||
|
@@ -289,7 +349,7 @@ ApiSecret: myapplication:secret:11f8dd7733744f2596f2a28544b5fbc4 | |
Content-Type: application/json | ||
{ | ||
"credentialId":"qgB2ZetBhi0rIcaQK8_HrLQzXXfwKia46_PNjUC2L_w" | ||
"credentialId": "qgB2ZetBhi0rIcaQK8_HrLQzXXfwKia46_PNjUC2L_w" | ||
} | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,7 @@ Next, implement a workflow on your backend and frontend for signing in with a [p | |
|
||
Code that you write must: | ||
|
||
1. On your frontend, initiate your sign-in and retrieve a [verification token](concepts.md#tokens) that will be checked by your backend to complete a sign-in. To initiate the sign-in, you can use an alias, userId, or Discoverable Credential ([learn more](frontend/javascript.md#signinwith)), for example: | ||
1. On your frontend, initiate your sign-in and retrieve an [authentication token](concepts.md#tokens) that will be checked by your backend to complete a sign-in. To initiate the sign-in, you can use an alias, userId, or Discoverable Credential ([learn more](frontend/javascript.md#signinwith)), for example: | ||
|
||
<Badge text="frontend" type="tip"/> | ||
|
||
|
@@ -200,7 +200,7 @@ const p = new Client({ | |
// Allow the user to specify a username or alias. | ||
const alias = '[email protected]'; | ||
|
||
// Generate a verification token for the user. | ||
// Generate an authentication token for the user. | ||
const { token, error } = await p.signinWithAlias(alias); | ||
// Tip: You can also try p.signinWithDiscoverable(); | ||
|
||
|
@@ -212,19 +212,19 @@ if (verifiedUser.success === true) { | |
} | ||
``` | ||
|
||
Successful implementation will make a verification token available to the backend. In the above example, the client waits for the backend to return `true` (**step 2**) before proceeding to act on the confirmed sign-in. | ||
Successful implementation will make an authentication token available to the backend. In the above example, the client waits for the backend to return `true` (**step 2**) before proceeding to act on the confirmed sign-in. | ||
|
||
2. Validate the verification token by calling the Passwordless.dev API's `/signin/verify` endpoint ([learn more](api.md#signin-verify)) with generated token, for example: | ||
2. Validate the authentication token by calling the Passwordless.dev API's `/signin/verify` endpoint ([learn more](api.md#signin-verify)) with generated token, for example: | ||
|
||
<Badge text="backend" type="warning"/> | ||
|
||
```js | ||
// Code written for this step should run on your backend. | ||
|
||
// Fetch the verification token from your frontend. | ||
// Fetch the authentication token from your frontend. | ||
const token = { token: req.query.token }; | ||
|
||
// POST the verification token to the Passwordless.dev API using your API private secret. | ||
// POST the authentication token to the Passwordless.dev API using your API private secret. | ||
const apiUrl = 'https://v4.passwordless.dev'; | ||
const response = await fetch(apiurl + '/signin/verify', { | ||
method: 'POST', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters