# Authenticate / Unauthenticate

### Step 1 - Configure FCL

```javascript
import * as fcl from "@blocto/fcl";

fcl.config({
  "accessNode.api": "https://rest-testnet.onflow.org", // connect to Flow testnet
  "discovery.wallet": `https://wallet-v2-dev.blocto.app/-/flow/authn` // use Blocto testnet wallet
});
```

Alternatively, if you already have user's email and would like to pre-fill it for user's Blocto account, you can use the custom `discovery.wallet` URL instead:

```javascript
import * as fcl from "@blocto/fcl";

const USER_EMAIL = "client@email.com";

fcl.config({
  "accessNode.api": "https://rest-testnet.onflow.org", // connect to Flow testnet
  "discovery.wallet": `https://wallet-v2-dev.blocto.app/-/flow/authn/${USER_EMAIL}` // use Blocto testnet wallet
});
```

### Step 2 - Authenticate

```javascript
import * as fcl from "@blocto/fcl";

// fires everytime account connection status updates
fcl.currentUser().subscribe(console.log);

// authenticate
fcl.authenticate();
```

### Step 3 - Unauthenticate

```javascript
import * as fcl from "@blocto/fcl";

// fires everytime account connection status updates
fcl.currentUser().subscribe(console.log);

// unauthenticate and clear account info in FCL
fcl.unauthenticate();
```

{% embed url="<https://codesandbox.io/s/flow-autenticate-unauthenticate-v2-hfq56w>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blocto.app/blocto-sdk/javascript-sdk/flow/login-register.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
