# A Quick Guide to React Login Options

**URL:** <https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335>\
**Category:** Developer Blog Comments\
**Created:** [December 16, 2020, 4:07pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335 "2020-12-16T16:07:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [December 16, 2020, 4:07pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/1 "2020-12-16T16:07:56Z")

</div>

[A Quick Guide to React Login Options](https://developer.okta.com/blog/2020/12/16/react-login)

This tutorial shows you how to add login options to a React app. Includes redirecting to log in, embedding a sign-in widget, and using plain ol’ JavaScript.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 27, 2021, 2:50am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/2 "2021-06-27T02:50:42Z")

</div>

**Jesse W**

Hey! Not sure, if you’ll see this, but I’ve successfully implemented the “Create Your Own Login Form” component as a functional component in my app. Currently, I also now need to add Facebook as a login option too, and for now just added a button that takes you to the Facebook login page… however I have no idea if it’s working because the callback takes me to some crazy page. I see a couple other posts mention adding an IDP option in the login… any idea where I would add it in the CYLF option?

Thank you!!!

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 29, 2021, 8:41pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/3 "2021-06-29T20:41:05Z")

</div>

**Matt Raible**

If you want to add social login with Facebook via Okta, see [our guide for Facebook](https://developer.okta.com/docs/guides/add-an-external-idp/facebook/before-you-begin/ "https://developer.okta.com/docs/guides/add-an-external-idp/facebook/before-you-begin/"). You will need to customize your hosted sign-in widget (or the one embedded within your app) to [include settings for Facebook](https://developer.okta.com/docs/guides/add-an-external-idp/facebook/use-idp-to-sign-in/#okta-sign-in-widget "https://developer.okta.com/docs/guides/add-an-external-idp/facebook/use-idp-to-sign-in/#okta-sign-in-widget").

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 14, 2021, 9:47am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/4 "2021-07-14T09:47:37Z")

</div>

**Refael dimri**

Cab i use this to my website? Where all the users are stored?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 16, 2021, 12:34am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/5 "2021-07-16T00:34:20Z")

</div>

**Jesse W**

Hey Matt,

I followed the guide, just posted a ticket. I don’t mind for now using a button that targets my authorization URL (users likely would rather see the FB login if they are using FB, seems more legit) but after a successful login through that, im redirected back without being authenticated. I do have a giant #id\_token=giant\_string but not sure what that does… any assistance is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 16, 2021, 12:34am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/6 "2021-07-16T00:34:56Z")

</div>

**Jesse W**

i was able to add this pretty easily to my site, users are stored in your okta directory

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [July 16, 2021, 11:14pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/7 "2021-07-16T23:14:51Z")

</div>

**Jesse W**

nvm figured it out!

---

<div class="post-metadata">

**Author:** ![Renzo](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Renzo](https://devforum.okta.com/u/Renzo)\
**Post date:** [February 4, 2022, 9:43pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/8 "2022-02-04T21:43:05Z")

</div>

Your code for the custom form no longer works. You need to add the following to the header.js file.

```auto
import { Link, useHistory } from 'react-router-dom';
if (!authState) return null;
const login = async () => { history.push('/protected') }
const logout = async () => { await oktaAuth.signOut(); }

```

This is important otherwise you get a wide array of unrelated errors.

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [February 4, 2022, 11:56pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/9 "2022-02-04T23:56:31Z")

</div>

Hello Renzo,

Did you use the versions of our React SDK that were specified in the post? If you use newer versions, yes, it’s likely there are errors - especially if you’re using a different major version.

---

<div class="post-metadata">

**Author:** ![Renzo](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Renzo](https://devforum.okta.com/u/Renzo)\
**Post date:** [February 5, 2022, 12:22am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/10 "2022-02-05T00:22:59Z")

</div>

Hi mriable, I’m using `@okta/okta-auth-js@5.1.1 , @okta/okta-react@6.0.0 , react-router-dom@5.2.1`.

However, when you have a custom sign in form, you specifically do not want to `signInWithRedirect()`. Otherwise it’ll redirect to the okta based form.

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [February 5, 2022, 12:29am UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/11 "2022-02-05T00:29:06Z")

</div>

I’m not surprised things don’t work. The tutorial specifies the following versions:

```auto
@okta/okta-react@5.0.0 @okta/okta-auth-js@4.8.0

```

I’m pretty sure everything works if you use these versions. We can add it to our list of posts to update.

---

<div class="post-metadata">

**Author:** ![Lowell](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@Lowell](https://devforum.okta.com/u/Lowell)\
**Post date:** [January 13, 2023, 3:38pm UTC](https://devforum.okta.com/t/a-quick-guide-to-react-login-options/17335/12 "2023-01-13T15:38:36Z")

</div>

App works great. Wasn’t sure at first.
