# Using Auth0 to authenticate within a Chrome Extension

**URL:** <https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848>\
**Category:** Get Help\
**Tags:** loginwithpopup, chrome-extension, api, login\
**Created:** [September 17, 2021, 10:46am UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848 "2021-09-17T10:46:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirai-auth0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mirai-auth0/32/12765_2.png) [@mirai-auth0](https://community.auth0.com/u/mirai-auth0)\
**Post date:** [September 17, 2021, 10:46am UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/1 "2021-09-17T10:46:01Z")

</div>

Hi,

This topic is similar to:

> [@Ultimate Guide to Auth0 In a Chrome Extension Popup](https://community.auth0.com/t/ultimate-guide-to-auth0-in-a-chrome-extension-popup/61362):
>
> I’ve been reading around how to implement Auth0 in a Chrome Extension but have not encountered any clear step by step guide on what to do. Is there anyone here that has successfully used Auth0 in a chrome popup with react that would be willing to guide us here? Thanks!

However, the information in that topic seems to no longer apply, or at least the successes there are only half-documented and I cannot replicate their success.

I am trying to authenticate within a Chrome Extension, and I see two possible methods:

1. Authenticate on the Extension Options page
2. Authenticate on the Extension Popup

I have tried option 1, however the `loginWithPopup()` method fails at creating a new popup window, instead a new tab is opened with the internal address of `about:blank#blocked`.  
(See similar GitHub issue: [PWA loginWithPopup blocked · Issue #300 · auth0/auth0-spa-js · GitHub](https://github.com/auth0/auth0-spa-js/issues/300))  
`loginWithRedirect()` is not an option here as the Extension Options is within a Chrome modal window, and this method just causes it to error and loose all of it’s content.

With option 2, the `loginWithPopup()` method can actually successfully open a popup window to the login page, but I’m now struggling with the correct redirect and callback URL values to use. I have tried setting them to be the `chrome://extensions/?id=extension-id-here` URL, hoping I could catch the token there, but the popup gets stuck on a blank “Authorisation Response” page.

Should I be using some middle-man hosted webpage to redirect to and collect the token?  
Has anyone got an actual functioning Auth0 flow within a Chrome Extension?

Appreciate any help.

---

<div class="post-metadata">

**Author:** ![gilhrpenner](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilhrpenner/32/31906_2.png) [@gilhrpenner](https://community.auth0.com/u/gilhrpenner)\
**Post date:** [September 24, 2021, 4:32pm UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/2 "2021-09-24T16:32:24Z")

</div>

Have you figured this out yet? I am having the same issue here.

---

<div class="post-metadata">

**Author:** ![mirai-auth0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mirai-auth0/32/12765_2.png) [@mirai-auth0](https://community.auth0.com/u/mirai-auth0)\
**Post date:** [September 24, 2021, 10:57pm UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/3 "2021-09-24T22:57:35Z")

</div>

Hey, yeah I have this working now, but I had to implement it without the use of the Auth0 SDK, just putting it all together manually.

I’ll update this thread with some samples this weekend.

---

<div class="post-metadata">

**Author:** ![mirai-auth0](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mirai-auth0/32/12765_2.png) [@mirai-auth0](https://community.auth0.com/u/mirai-auth0)\
**Post date:** [September 26, 2021, 8:37pm UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/4 "2021-09-26T20:37:05Z")

</div>

@gilhrpenner I put together a post: [Robert Tolton | Implementing Auth0 Authentication into a Chrome…](https://roberttolton.com/posts/implementing-auth0-authentication-into-a-chrome-extension)

Let me know if there’s anything unclear.

---

<div class="post-metadata">

**Author:** ![gilhrpenner](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilhrpenner/32/31906_2.png) [@gilhrpenner](https://community.auth0.com/u/gilhrpenner)\
**Post date:** [September 26, 2021, 9:05pm UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/5 "2021-09-26T21:05:24Z")

</div>

@mirai-auth0 I will try your approach tomorrow but from quickly reading it I can see where I’ve been doing it wrong.  
Thank you so much for this! Really thankful

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [September 27, 2021, 9:33am UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/6 "2021-09-27T09:33:32Z")

</div>

Thanks for sharing it Mirai with the rest of community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 12, 2021, 9:33am UTC](https://community.auth0.com/t/using-auth0-to-authenticate-within-a-chrome-extension/69848/7 "2021-10-12T09:33:40Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
