It’s Cybersecurity Awareness Month! Join our interactive training session, or learn about security and AI from 1Password experts.
Forum Discussion
valerykolganov
4 months agoNew Contributor
Error when working with the API
I want to pull a specific secret from a specific vault, but I can't do it. The token was created in the Service Account and made correctly, with access to read the required vault. headers = {"Aut...
- 4 months ago
The query wouldn't be valid because 'api.1password.com' is not a valid URL as we do not have public facing APIs for the 1Password service. This is something we've definitely heard feedback for before so I can add your backing to the request.
At this time, your best option would be to setup a Connect Server for API calls specifically.
Alternatively, you could instead use a Service Account and our SDKs in your Lambda function which would connect directly to the 1Password service, just not through a standard REST API like the example you first posted. Below is an example pulling a secret from a vault using our Python SDK:
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points. value = await client.secrets.resolve( f"op://{created_item.vault_id}/{created_item.id}/username" ) print(value)
valerykolganov
4 months agoNew Contributor
It's possible! But I still would like to do it without a server, and use it directly.
My AWS Lambda function can't make a valid query, I want to figure it out
estoler-ag
1Password Team
4 months agoThe query wouldn't be valid because 'api.1password.com' is not a valid URL as we do not have public facing APIs for the 1Password service. This is something we've definitely heard feedback for before so I can add your backing to the request.
At this time, your best option would be to setup a Connect Server for API calls specifically.
Alternatively, you could instead use a Service Account and our SDKs in your Lambda function which would connect directly to the 1Password service, just not through a standard REST API like the example you first posted. Below is an example pulling a secret from a vault using our Python SDK:
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
value = await client.secrets.resolve(
f"op://{created_item.vault_id}/{created_item.id}/username"
)
print(value)