Skip to content

Commit 99468f2

Browse files
committed
Add anonymous auth and custom token
1 parent 1626198 commit 99468f2

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

packages-exp/auth-exp/demo/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ in the `config.js` file.
4242

4343
## Deploy
4444

45+
Before deploying, you may need to build the auth-exp package:
46+
```bash
47+
yarn build:deps
48+
```
49+
50+
This can take some time, and you only need to do it if you've modified the auth-exp package.
51+
4552
To run the app locally, simply issue the following command in the `auth-exp/demo` directory:
4653

4754
```bash

packages-exp/auth-exp/demo/src/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
updateEmail,
3333
updatePassword,
3434
updateProfile,
35+
signInAnonymously,
36+
signInWithCustomToken,
3537
isSignInWithEmailLink,
3638
fetchSignInMethodsForEmail
3739
} from '@firebase/auth-exp';
@@ -376,21 +378,19 @@ function onReauthenticateWithEmailLink() {
376378
* @param {DOMEvent} event HTML DOM event returned by the listener.
377379
*/
378380
function onSignInWithCustomToken(event) {
379-
alertNotImplemented();
380381
// The token can be directly specified on the html element.
381-
// var token = $('#user-custom-token').val();
382+
var token = $('#user-custom-token').val();
382383

383-
// auth.signInWithCustomToken(token)
384-
// .then(onAuthUserCredentialSuccess, onAuthError);
384+
signInWithCustomToken(auth, token)
385+
.then(onAuthUserCredentialSuccess, onAuthError);
385386
}
386387

387388
/**
388389
* Signs in anonymously.
389390
*/
390391
function onSignInAnonymously() {
391-
alertNotImplemented();
392-
// auth.signInAnonymously()
393-
// .then(onAuthUserCredentialSuccess, onAuthError);
392+
signInAnonymously(auth)
393+
.then(onAuthUserCredentialSuccess, onAuthError);
394394
}
395395

396396
/**

0 commit comments

Comments
 (0)