---
reference:
  js:
    - key: authenticate
      id: authenticate
      url: /reference/authkit/session-helpers
      title: session.authenticate()
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - key: accessToken
              type: string
              description: The access token for the session.
            - 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: >-
                "invalid_jwt" | "invalid_session_cookie" |
                "no_session_cookie_provided"
              optional: true
              description: >-
                The reason authentication failed. Only present if `authenticated
                = false`.
  ruby:
    - key: authenticate
      id: authenticate
      url: /reference/authkit/session-helpers
      title: session.authenticate()
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - 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: The role of the user.
            - key: permissions
              optional: true
              type: array
              description: The permissions of the user.
            - key: feature_flags
              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: >-
                "invalid_jwt" | "invalid_session_cookie" |
                "no_session_cookie_provided"
              optional: true
              description: >-
                The reason authentication failed. Only present if `authenticated
                = false`.
  python:
    - key: authenticate
      id: authenticate
      url: /reference/authkit/session-helpers
      title: session.authenticate()
      returns:
        - key: anonymous
          type: object
          unwrap: true
          properties:
            - key: authenticated
              type: boolean
              description: (authentication.authenticated)
            - 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: >-
                "invalid_jwt" | "invalid_session_cookie" |
                "no_session_cookie_provided"
              optional: true
              description: >-
                The reason authentication failed. Only present if `authenticated
                = false`.
originalPath: >-
  .tmp-workos-clone/packages/docs/content/reference/authkit/session-helpers/authenticate.mdx
---

## Authenticate

Unseals the session data and checks if the session is still valid.

<CodeBlock
  referenceId="authenticate"
  title="Authenticate"
  file="session-helpers-authenticate"
/>
