# Auth0-js with PKCE

**URL:** <https://community.auth0.com/t/auth0-js-with-pkce/33044>\
**Category:** Get Help\
**Tags:** auth0js\
**Created:** [October 29, 2019, 5:56pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044 "2019-10-29T17:56:16Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcardle.liam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mcardle.liam/32/15457_2.png) [@mcardle.liam](https://community.auth0.com/u/mcardle.liam)\
**Post date:** [October 29, 2019, 5:56pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/1 "2019-10-29T17:56:16Z")

</div>

Does the Auth0-js library support the Authorization Code Grant Flow with PKCE Grant? I do not see it in the auth0-js documentation.

---

<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:** [October 30, 2019, 4:41pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/3 "2019-10-30T16:41:03Z")

</div>

Hey there!

This flow is aimed at mobile/native apps and auth0-js is not an SDK for this kind of things. This document should tell you everything that you need to know about this flow with PKCE:

> **[Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce)**
>
> Learn how the Authorization Code flow with Proof Key for Code Exchange (PKCE) works and why you should use it for native and mobile apps.

---

<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:** [October 30, 2019, 4:48pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/4 "2019-10-30T16:48:42Z")

</div>

and as far as I don’t know your usecase the SDK you potentially look for is auth0-spa-js (which is kinda deviation from auth0-js):

> **[GitHub - auth0/auth0-spa-js: Auth0 authentication for Single Page...](https://github.com/auth0/auth0-spa-js)**
>
> Auth0 authentication for Single Page Applications (SPA) with PKCE - GitHub - auth0/auth0-spa-js: Auth0 authentication for Single Page Applications (SPA) with PKCE

---

<div class="post-metadata">

**Author:** ![mcardle.liam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mcardle.liam/32/15457_2.png) [@mcardle.liam](https://community.auth0.com/u/mcardle.liam)\
**Post date:** [October 30, 2019, 7:54pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/5 "2019-10-30T19:54:51Z")

</div>

> [@konrad.sopala](#):
>
> This flow is aimed at mobile/native apps and auth0-js is not an SDK for this kind of things.

I believe this is incorrect. The `authorization code flow with PKCE` is certainly for SPAs. The implicit grant was historically used for SPAs because of browser limitations…which is no longer the case. FYI, your own documentation talks about this: [OAuth2 Implicit Grant and SPA](https://auth0.com/blog/oauth2-implicit-grant-and-spa/)

---

<div class="post-metadata">

**Author:** ![mcardle.liam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mcardle.liam/32/15457_2.png) [@mcardle.liam](https://community.auth0.com/u/mcardle.liam)\
**Post date:** [October 30, 2019, 7:56pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/6 "2019-10-30T19:56:28Z")

</div>

> [@konrad.sopala](#):
>
> the SDK you potentially look for is auth0-spa-js (which is kinda deviation from auth0-js):

Yes, that library looks nice, however I need to control the look and feel (i.e. embedded login), which that library does not support. So hoping to use the legacy library (auth0-js) for this flow rather than rolling my own.

---

<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:** [October 31, 2019, 3:04pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/7 "2019-10-31T15:04:47Z")

</div>

Gotchya! Let me research that option and get back to you with the news soon!

---

<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:** [November 15, 2019, 3:04pm UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/8 "2019-11-15T15:04:52Z")

</div>

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

---

<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:** [April 14, 2020, 9:05am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/9 "2020-04-14T09:05:06Z")

</div>



---

<div class="post-metadata">

**Author:** ![ajv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ajv/32/8910_2.png) [@ajv](https://community.auth0.com/u/ajv)\
**Post date:** [April 15, 2020, 8:06am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/10 "2020-04-15T08:06:02Z")

</div>

Thanks for re-opening this @konrad.sopala. Have you had the time to research this?

As @mcardle.liam also mentioned, `auth0-spa-js` won’t work for many since it’s quite limited (not embeddable, not that great for custom UI, can’t have both the passwordless and password login methods present, etc.). It’d be great if `auth0-js`’s feature set wouldn’t be left behind, so people who wish to deviate from the planned flow could do so 🙌 🤞

---

<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:** [April 15, 2020, 10:11am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/11 "2020-04-15T10:11:35Z")

</div>

That’s the product decision the team did long ago when designing auth0-spa-js and diffrentiating it from auth0-js. The best way to advocate for that would be to raise the GitHub issue in the auth0-js repo describing usecase and your struggle and then share the link to it with us here so you can talk about it directly with repo maintainers. Thanks!

---

<div class="post-metadata">

**Author:** ![ajv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ajv/32/8910_2.png) [@ajv](https://community.auth0.com/u/ajv)\
**Post date:** [April 28, 2020, 7:44am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/12 "2020-04-28T07:44:47Z")

</div>

[https://github.com/auth0/auth0.js/issues/941](https://github.com/auth0/auth0.js/issues/941)

---

<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:** [April 28, 2020, 8:02am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/13 "2020-04-28T08:02:38Z")

</div>

Thanks I just pinged repo maintainers regarding that!

---

<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:** [May 13, 2020, 8:02am UTC](https://community.auth0.com/t/auth0-js-with-pkce/33044/14 "2020-05-13T08:02:40Z")

</div>

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