Version 4.0.26.22 (latest)

### Create an access token that runs as a given user.

This can only be called by an authenticated admin user. It allows that admin to generate a new
authentication token for the user with the given user id. That token can then be used for subsequent
API calls - which are then performed *as* that target user.

The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such
credentials are created by this call.

This allows for building systems where api user authentication for an arbitrary number of users is done
outside of Looker and funneled through a single 'service account' with admin permissions. Note that a
new access token is generated on each call. If target users are going to be making numerous API
calls in a short period then it is wise to cache this authentication token rather than call this before
each of those API calls.

See 'login' for more detail on the access token and how to use it.

In [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview) this call will be denied unless all of the following criteria are met:

1. The calling user is an [API-only Service Account](https://docs.cloud.google.com/looker/docs/looker-core-user-management#creating_an_api-only_service_account) with the Admin role
2. The target user is an [Embed User type](https://docs.cloud.google.com/looker/docs/r/single-sign-on-embedding) Regular user types can not be impersonated in [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview). If your application needs to call the API for these users, use OAuth authentication instead.

## Request

POST /login/{user_id} Datatype Description Request HTTP Request path HTTP Path Expand HTTP Path definition... user_id string Id of user.

## Response

### 200: Access token with metadata.

Datatype Description (object) [AccessToken](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/AccessToken) access_token string Access Token used for API calls token_type string Type of Token expires_in integer Number of seconds before the token expires refresh_token string Refresh token which can be used to obtain a new access token

### 400: Bad Request

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 403: Permission Denied

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 404: Not Found

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 429: Too Many Requests

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

## Examples

### Python


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py](https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py#L45 "https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py") |