---
reference:
  js:
    - key: refresh
      id: refresh
      url: /reference/authkit/session-helpers
      title: session.refresh()
      parameters:
        - key: options
          type: object
          unwrap: true
          properties:
            - key: cookiePassword
              type: string
              optional: true
              description: >-
                The password with which to encrypt the new session. Only pass
                this in if you want to set a new password separate from the one
                provided in `loadSessionData`.
            - key: organizationId
              type: string
              optional: true
              description: >-
                The organization ID to use for the new session cookie. Use this
                if you want to switch organizations.
      returns:
        - key: anonymous
          type: RefreshSessionResponse
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - key: session
              type: object
              description: The user session.
            - key: sealedSession
              type: string
              description: >-
                Sealed version of the user session. Use this in the session
                cookie.
            - key: sessionId
              type: string
              description: The ID of the session.
            - key: user
              type: User
              description: (user.self)
            - key: organizationId
              type: string
              optional: true
              description: The ID of the organization.
            - key: role
              type: string
              optional: true
              description: (access_token.role)
            - key: roles
              type: array
              optional: true
              description: (access_token.roles)
            - key: permissions
              optional: true
              type: array
              description: The permissions of the user.
            - key: entitlements
              optional: true
              type: array
              description: The entitlements of the user.
            - key: featureFlags
              optional: true
              type: array
              description: The feature flags of the user.
            - key: impersonator
              type: object
              optional: true
              properties:
                - key: email
                  type: string
                  description: (authentication.impersonator.email)
                - key: reason
                  type: string
                  optional: true
                  description: (authentication.impersonator.reason)
            - key: reason
              type: string
              optional: true
              description: >-
                The reason the session failed to refresh. Only present if
                `authenticated = false`.
  ruby:
    - key: refresh
      id: refresh
      url: /reference/authkit/session-helpers
      title: session.refresh()
      parameters:
        - key: options
          type: object
          unwrap: true
          properties:
            - key: cookie_password
              type: string
              optional: true
              description: >-
                The password with which to encrypt the new session. Only pass
                this in if you want to set a new password separate from the one
                provided in `load_session_data`.
            - key: organization_id
              type: string
              optional: true
              description: >-
                The organization ID to use for the new session cookie. Use this
                if you want to switch organizations.
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - key: session
              type: object
              description: The user session.
            - key: sealed_session
              type: string
              description: >-
                Sealed version of the user session. Use this in the session
                cookie.
            - key: reason
              type: string
              optional: true
              description: >-
                The reason the session failed to refresh. Only present if
                `authenticated = false`.
  python:
    - key: refresh
      id: refresh
      url: /reference/authkit/session-helpers
      title: session.refresh()
      parameters:
        - key: options
          type: object
          unwrap: true
          properties:
            - key: cookie_password
              type: string
              optional: true
              description: >-
                The password with which to encrypt the new session. Only pass
                this in if you want to set a new password separate from the one
                provided in `load_session_data`.
            - key: organization_id
              type: string
              optional: true
              description: >-
                The organization ID to use for the new session cookie. Use this
                if you want to switch organizations.
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - key: sealed_session
              type: string
              description: >-
                Sealed version of the user session. Use this in the session
                cookie.
            - key: session_id
              type: string
              description: The ID of the session.
            - key: user
              type: User
              description: (user.self)
            - key: organization_id
              type: string
              optional: true
              description: The ID of the organization.
            - key: role
              type: string
              optional: true
              description: (access_token.role)
            - key: roles
              type: array
              optional: true
              description: (access_token.roles)
            - key: permissions
              optional: true
              type: array
              description: The permissions of the user.
            - key: entitlements
              optional: true
              type: array
              description: The entitlements of the user.
            - key: impersonator
              type: object
              optional: true
              properties:
                - key: email
                  type: string
                  description: (authentication.impersonator.email)
                - key: reason
                  type: string
                  optional: true
                  description: (authentication.impersonator.reason)
            - key: reason
              type: string
              optional: true
              description: >-
                The reason the session failed to refresh. Only present if
                `authenticated = false`.
originalPath: >-
  .tmp-workos-clone/packages/docs/content/reference/authkit/session-helpers/refresh.mdx
---

## Refresh

Refreshes the user's session with the refresh token. Passing in a new organization ID will switch the user to that organization.

<CodeBlock
  referenceId="refresh"
  title="Refresh"
  file="session-helpers-refresh"
/>
