> ## Documentation Index
> Fetch the complete documentation index at: https://docs.verifyyou.com/llms.txt
> Use this file to discover all available pages before exploring further.

# vyget()

> Read the verification result, from the return URL or the last embedded flow.

`vyget()` reads the result of a verification. In redirect mode it parses the parameters the hosted flow appended to your return URL. In the iframe modes it returns the last completed result, the same one `onComplete` received.

```bash theme={null}
npm install @verifyyou-sdk/client
```

```ts theme={null}
import { vyget } from "@verifyyou-sdk/client";

const { token, verified } = vyget();
```

## What it does

When a user returns from a redirect flow, the URL looks like this:

```
https://yourapp.com/verified?vyt=<token>&vyc=1
```

`vyget()` reads the two reserved parameters and returns them as a typed object:

* **`vyt`** is the confirmation **token**. This is the proof you exchange on your backend for the authoritative result.
* **`vyc`** is the client-side **verdict** hint: `1` (passed) or `0` (failed).

```ts theme={null}
interface VyResult {
  token: string | null;    // from vyt, or null if absent
  verified: boolean;       // true only when vyc is "1"
  vyc: string | null;      // the raw verdict code
}
```

## How it works

`vyget()` is synchronous and makes no network calls. It checks the URL first; if there are no `vy` parameters and an embedded flow completed earlier on this page, it returns that result instead.

| Situation                              | Returns                                          |
| -------------------------------------- | ------------------------------------------------ |
| URL has `?vyt=tok_123&vyc=1`           | `{ token: "tok_123", verified: true, vyc: "1" }` |
| URL has `?vyc=0`                       | `{ token: null, verified: false, vyc: "0" }`     |
| A drawer or inline flow just completed | that flow's result                               |
| Nothing to read                        | `{ token: null, verified: false, vyc: null }`    |

It is safe to call anywhere, on every page load. If there is nothing to read you get the empty result rather than an error.

## Use it on page load

Call `vyget()` when your page mounts. A token means the user just came back from verifying. Hand it to your backend to [confirm](/v3/api/confirmations), then clean the parameters off the URL so a refresh can't replay them.

```ts theme={null}
import { vyget } from "@verifyyou-sdk/client";

const { token } = vyget();
if (token) {
  await fetch("/api/verify/confirm", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ token }),
  });
  // Then strip ?vyt / ?vyc from the URL:
  const url = new URL(window.location.href);
  url.searchParams.delete("vyt");
  url.searchParams.delete("vyc");
  window.history.replaceState({}, "", url);
}
```

Confirm each token exactly once and guard against duplicate calls. Development tooling like React StrictMode runs effects twice, and a second confirmation of a token you already accepted and locked reads as a rejection.

<Warning>
  `verified` is a convenience for your UI. Anyone can edit a URL. For anything
  that matters, send the `token` to your backend and
  [confirm](/v3/api/confirmations) it with your secret key.
</Warning>

<Note>
  No result to read? Start a verification with
  [`vycheck()`](/v3/sdk/vycheck).
</Note>
