# Acces to "Custom Connexion" by code

**URL:** <https://forum.wixstudio.com/t/acces-to-custom-connexion-by-code/64450>\
**Category:** Ask the community\
**Tags:** wix, question, code\
**Created:** [November 8, 2024, 6:58pm UTC](https://forum.wixstudio.com/t/acces-to-custom-connexion-by-code/64450 "2024-11-08T18:58:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user3410](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@user3410](https://forum.wixstudio.com/u/user3410)\
**Post date:** [November 8, 2024, 6:58pm UTC](https://forum.wixstudio.com/t/acces-to-custom-connexion-by-code/64450/1 "2024-11-08T18:58:49Z")

</div>

**Question:**  
[Clearly ask your question.]

**Product:**  
Wix EDITOR

**What are you trying to achieve:**

Good evening everyone

I would like to access the WIX “custom login” window via a code.  
Normally, to access a page, you access it via “Wixlocation.to()”.  
How to open a window by code? (  
I tried “Wix Frontend” but without result.

Thanks to all

Here is the code I use:

**What have you already tried:**

> $w(‘#MonCompte’).onClick((event) =\> {

> ```
> if (wixUsers.currentUser.loggedIn) {
> wixLocation.to('/moncompte')
> }else{
> ???????????? (Go to "Wix connexion")
> }    
> 
> ```
> 
> })

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [November 8, 2024, 11:18pm UTC](https://forum.wixstudio.com/t/acces-to-custom-connexion-by-code/64450/2 "2024-11-08T23:18:39Z")

</div>

Hey Denis,

**wix-users** & **wix-location** are both deprecated APIs. I’d recommend that you switch over to **wix-members-frontend** & **wix-location-frontend** respectivley.

Your page code should look something like this:

```javascript
import { authentication } from "wix-members-frontend";
import wixLocationFrontend from 'wix-location-frontend';

$w.onReady(function () {

    const isLoggedIn = authentication.loggedIn();

    $w('#MonCompte').onClick((event) => {
        if (isLoggedIn) {
            wixLocationFrontend.to('/moncompte');
        } else {

            let options = {
                mode: 'login', //either 'login' or 'signup'
                modal: true //true for popup, false for fullscreen
            }

            authentication
                .promptLogin(options)
                .then(() => {
                    console.log("Member is logged in");
                })
                .catch((error) => {
                    console.error(error);
                });
        }
    })

});

```

---

<div class="post-metadata">

**Author:** ![user3410](https://avatars.discourse-cdn.com/v4/letter/u/db5fbb/32.png) [@user3410](https://forum.wixstudio.com/u/user3410)\
**Post date:** [November 9, 2024, 9:55am UTC](https://forum.wixstudio.com/t/acces-to-custom-connexion-by-code/64450/3 "2024-11-09T09:55:57Z")

</div>

Hi Pratham,

Thank you for this quick and efficient feedback. Everything is OK and works perfectly. I also took the opportunity to update my various codes concerning the deprecated wix-users & wix-location APIs, and updated them to **wix-members-frontend** & **wix-location-frontend** as you asked me to do. Thanks a lot …

Have a nice weekend
