# Firebase Authentication Error

**URL:** <https://travis-ci.community/t/firebase-authentication-error/628>\
**Category:** Deployment\
**Tags:** firebase\
**Created:** [November 3, 2018, 5:58am UTC](https://travis-ci.community/t/firebase-authentication-error/628 "2018-11-03T05:58:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinxiao](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xinxiao/32/345_2.png) [@xinxiao](https://travis-ci.community/u/xinxiao)\
**Post date:** [November 3, 2018, 5:58am UTC](https://travis-ci.community/t/firebase-authentication-error/628/1 "2018-11-03T05:58:46Z")

</div>

I kept getting this error when I followed the tutorial to set up Firebase deployment

Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See [https://developers.google.com/identity/sign-in/web/devconsole-project](https://developers.google.com/identity/sign-in/web/devconsole-project).

Any help is appreciated

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [November 5, 2018, 1:22pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/2 "2018-11-05T13:22:03Z")

</div>

Most likely your credentials are incorrect at the deployment time. If you encrypted your credentials, they were probably encrypted incorrectly. Try specifying the repo with `-r`, and the endpoint with `--pro` (for .com), or `--org` (for .org); e.g.,

```
travis encrypt -r OWNER/REPO --com

```

Alternatively, try setting it on the settings panel.

---

<div class="post-metadata">

**Author:** ![immnk](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/immnk/32/738_2.png) [@immnk](https://travis-ci.community/u/immnk)\
**Post date:** [December 12, 2018, 12:48pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/3 "2018-12-12T12:48:05Z")

</div>

I am not successful with the approach. Anyone else is lucky with this?

---

<div class="post-metadata">

**Author:** ![Chan4077](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/chan4077/32/826_2.png) [@Chan4077](https://travis-ci.community/u/Chan4077)\
**Post date:** [December 22, 2018, 1:59pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/4 "2018-12-22T13:59:19Z")

</div>

Setting `edge` to `true` has seemed to resolve the problem.

This could possibly be because of a recent change to the `firebase-tools` which has fixed the issue.

---

<div class="post-metadata">

**Author:** ![joeleduardo](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/joeleduardo/32/1038_2.png) [@joeleduardo](https://travis-ci.community/u/joeleduardo)\
**Post date:** [January 23, 2019, 3:17pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/5 "2019-01-23T15:17:29Z")

</div>

Try this:

```
script:
- npm test
- npm run build
after_success:
  - firebase use --token $FIREBASE_TOKEN YOUR_FIREBASE_PROJECT_ID
  - firebase --non-interactive --token $FIREBASE_TOKEN
```

---

<div class="post-metadata">

**Author:** ![jamescrowley](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/jamescrowley/32/1487_2.png) [@jamescrowley](https://travis-ci.community/u/jamescrowley)\
**Post date:** [April 1, 2019, 5:29pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/6 "2019-04-01T17:29:40Z")

</div>

hey - could you clarify how you set this flag? We’re experiencing the same issue. Tried setting

```
deploy:
  provider: firebase
  project: XXX
  edge: true
  token: 
    secure: XXX

```

but that didn’t work.

---

<div class="post-metadata">

**Author:** ![xinxiao](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xinxiao/32/345_2.png) [@xinxiao](https://travis-ci.community/u/xinxiao)\
**Post date:** [April 1, 2019, 5:43pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/7 "2019-04-01T17:43:32Z")

</div>

All configurations here looks correct. However, If you happened to be trying to deploy a web application built be webpack on Firebase Hosting you might want to try to set you `cleanup` option to persist the built artifact.

---

<div class="post-metadata">

**Author:** ![jamescrowley](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/jamescrowley/32/1487_2.png) [@jamescrowley](https://travis-ci.community/u/jamescrowley)\
**Post date:** [April 1, 2019, 9:07pm UTC](https://travis-ci.community/t/firebase-authentication-error/628/8 "2019-04-01T21:07:11Z")

</div>

Thanks - we were using the clean argument, turned I we hadn’t got the syntax right, and @BanzaiMan’s solution worked for us after all. That is

travis encrypt “1/BLAHBLAHBLAH” -r org/repo --com --add
