---
title: Managing sessions and tokens in React Native
description: "Manage the authenticated user's session and OIDC tokens after a DaVinci flow completes in React Native"
component: orchsdks
page_id: orchsdks:davinci:usage/react-native/06-handling-sessions
canonical_url: https://developer.pingidentity.com/orchsdks/davinci/usage/react-native/06-handling-sessions.html
llms_txt: https://developer.pingidentity.com/orchsdks/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: Thu, 27 Aug 2026 00:00:00 +0000
keywords: ["DaVinci", "React Native", "Sessions", "Tokens", "OIDC", "PingOne"]
section_ids:
  getting_session_information: Getting session information
  refreshing_tokens: Refreshing tokens
  getting_user_information: Getting user information
  revoking_tokens: Revoking tokens
  sign_out: Signing users out
---

# Managing sessions and tokens in React Native

[icon: circle-check, set=far]PingOne [icon: react, set=fab]React Native

* [Prepare](01-configuring-the-server.html)

* [Install](02-installing-the-davinci-module.html)

* [Configure](03-configuring-the-davinci-module.html)

* [Start](04-starting-a-davinci-flow.html)

* [Navigate](05-stepping-through-davinci-flows.html)

* **Manage**

After a DaVinci flow completes successfully, you can inspect the user's active session and manage the OIDC tokens it contains.

The React Native DaVinci module does not expose a separate server session token alongside the OIDC access and refresh tokens.

The examples on this page use the client directly. You can call the same methods through the actions returned by `useDaVinci`.

The `user()`, `refresh()`, and `userinfo()` methods return `null` only when there is no active session.

If retrieving the session or the user information fails, the operation rejects with a `DaVinciError` whose `code` property is `DAVINCI_SESSION_ERROR`.

For more information about handling errors, see [Error handling](04-starting-a-davinci-flow.html#_error_handling).

## Getting session information

After the flow reaches `SuccessNode`, call `user()` to retrieve the active OIDC session:

Getting the active user session

```typescript
const session = await davinciClient.user();

console.log('Access token:', session?.accessToken);
console.log('Refresh token:', session?.refreshToken);
console.log('Expires in:', session?.expiresIn);
```

`user()` returns `null` if there is no active session.

The returned session includes the following properties when they are available:

* `accessToken`

  The OAuth 2.0 access token.

* `refreshToken`

  The OAuth 2.0 refresh token, if issued.

* `expiresIn`

  The access token lifetime in seconds, if provided.

## Refreshing tokens

Call `refresh()` to obtain an updated session using the current refresh token:

Refreshing the user's tokens

```typescript
const refreshedSession = await davinciClient.refresh();

console.log('New access token:', refreshedSession?.accessToken);
```

The method returns the updated session or `null` if no active session is available.

## Getting user information

Call `userinfo()` to retrieve the user's claims from the OIDC user information endpoint:

Fetching user information

```typescript
const userInfo = await davinciClient.userinfo();

console.log(userInfo);
```

The method returns the claims as an object, or `null` if there is no active session.

## Revoking tokens

To request revocation of the active access and refresh tokens, call `revoke()`:

Revoking the user's tokens

```typescript
const revoked = await davinciClient.revoke();

console.log('Tokens revoked:', revoked);
```

The `revoke()` call returns a Boolean result from the native DaVinci module.

Use `logoutUser()` to [completely sign out an authenticated user](#sign_out) and clear the active DaVinci session.

## Signing users out

To sign the user out and clear the active DaVinci session, call `logoutUser()`:

Signing the user out

```typescript
await davinciClient.logoutUser();
```
