## On this page

The `/oauth2/userinfo` endpoint returns information about the authenticated user.

## GET `/oauth2/userinfo`

The user pool client makes requests to this endpoint directly and not through a browser.

For more information, see [UserInfo Endpoint](http://openid.net/specs/openid-connect-core-1_0.html#UserInfo) in the OpenID Connect (OIDC) specification.

## Request parameters in header

#### `Authorization` (Required)

Pass the access token using the authorization header field.

```text
Authorization: Bearer <ACCESS_TOKEN>
```

## Examples positive responses

#### Sample request

```text
GET https://api.medplum.com/oauth2/userinfo

Authorization: Bearer <access_token>
```

#### Sample response

```text
HTTP/1.1 200 OK

Content-Type: application/json;charset=UTF-8

{
    "sub": "248289761001",
    "name": "Jane Doe",
    "given_name": "Jane",
    "family_name": "Doe",
    "preferred_username": "j.doe",
    "email": "janedoe@example.com"
}
```

For a list of OIDC claims, see [Standard Claims](http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims).

Contact Information

The `email` and `phone` values of the `/userinfo` endpoint are generated from the user's [Profile resource](/content/docs/fhir-datastore/profiles/index.html).

## Sample negative responses

#### Invalid request

```text
HTTP/1.1 400 Bad Request

WWW-Authenticate: error="invalid_request",
    error_description="Bad OAuth2 request at UserInfo Endpoint"
```

##### `invalid_request`
The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.

#### Invalid token

```text
HTTP/1.1 401 Unauthorized

WWW-Authenticate: error="invalid_token",
    error_description="Access token is expired, disabled, or deleted, or the user has globally signed out."
```

##### `invalid_token`
The access token is expired, revoked, malformed, or invalid.

- [GET `/oauth2/userinfo`](/content/docs/api/oauth/userinfo#get-oauth2userinfo/index.html)
- [Request parameters in header](/content/docs/api/oauth/userinfo#request-parameters-in-header/index.html)
- [Examples positive responses](/content/docs/api/oauth/userinfo#examples-positive-responses/index.html)
- [Sample negative responses](/content/docs/api/oauth/userinfo#sample-negative-responses/index.html)
