Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from web-auth/Documentation
Browse files Browse the repository at this point in the history
Doc for the new header parameter arguments
  • Loading branch information
Spomky authored Aug 1, 2020
2 parents cdf301f + 7afee50 commit 1c381f6
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ yarn add webauthn-helper
```
# Usage

## Registration

```js
// Import the tool(s) ou need
import {useRegistration, useLogin} from 'webauthn-helper';
import {useRegistration} from 'webauthn-helper';

// We want to register new authenticators
const register = useRegistration({
Expand All @@ -30,8 +32,13 @@ register({
.then((response)=> console.log('Registration success'))
.catch((error)=> console.log('Registration failure'))
;
```

## Authentication

```js
import {useLogin} from 'webauthn-helper';

// We want to authenticate a user
const login = useLogin({
loginUrl: '/api/login',
loginOptions: '/api/login/options'
Expand All @@ -45,11 +52,32 @@ login({
;
```

## Additional Header Parameters

For both `useLogin` and `useRegistration` methods, you can add custom header parameters.

```js
import {useLogin} from 'webauthn-helper';

const login = useLogin({
loginUrl: '/api/login',
actionHeader: {
'X-TOKEN': 'Secured-TOKEN!!!'
},
loginOptions: '/api/login/options',
optionsHeader: {
'X-TOKEN': 'Secured-TOKEN!!!',
'X-OTHER-PARAM': '1,2,3,4'
}
});
```


# Support

I bring solutions to your problems and answer your questions.

If you really love that project and the work I have done or if you want I prioritize your issues, then you can help me out for a couple of :beers: or more!
If you really love that project, and the work I have done or if you want I prioritize your issues, then you can help me out for a couple of :beers: or more!

[Become a sponsor](https://github.com/sponsors/Spomky)

Expand Down

0 comments on commit 1c381f6

Please sign in to comment.