
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
OAuthManager is a Python package for managing API authentication using 1Password Service Accounts and securely caching credentials.
OP_SERVICE_ACCOUNT_TOKEN
).cryptography
Python packageInstall Python and Pip
Ensure you have Python 3.11 installed on your system. You can download it from python.org.
Install the OAuthManager package
You can install the OAuthManager package directly from PyPI:
pip install oauthmanager
To begin, sign up for a 1Password account. You will need to be on a 1Password Teams, Business, or Enterprise plan to create service accounts.
A service account allows OAuthManager to securely retrieve your API credentials. Follow the steps below to create one:
⚠️ Important: The service account token is shown only once during the creation process. Save it immediately in your 1Password account.
You will need to set two environment variables:
OP_SERVICE_ACCOUNT_TOKEN
: The service account token created in the previous step.OP_CACHE
: Enable caching for faster retrieval.Open your terminal.
Use the following command to open your .bashrc
, .bash_profile
, or .zshrc
(depending on your shell):
nano ~/.bashrc
Add the following lines to export your service account token and enable caching:
export OP_SERVICE_ACCOUNT_TOKEN="your-service-account-token"
export OP_CACHE="true"
Save the file and run:
source ~/.bashrc
Open the Command Prompt as Administrator.
Set the environment variables:
setx OP_SERVICE_ACCOUNT_TOKEN "your-service-account-token"
setx OP_CACHE "true"
This sets the variables globally. Restart the terminal for them to take effect.
Once you’ve installed OAuthManager and set up the necessary environment variables, you can start retrieving credentials from 1Password.
from oauthmanager import AuthManager, OnePasswordAuthManager
# Initialize the Auth Manager
auth_manager = OnePasswordAuthManager()
# Retrieve credentials for Spotify
spotify_creds = auth_manager.get_credentials("Spotify", "client_id", "client_secret", "uri")
# Use the credentials
print(f"Client ID: {spotify_creds['client_id']}")
print(f"Client Secret: {spotify_creds['client_secret']}")
print(f"Redirect URI: {spotify_creds['uri']}")
By default, the OAuthManager caches credentials locally using encryption. To refresh the cache, simply delete the credentials_cache.json
file, or let it expire after 24 hours.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A module for managing API authentication using 1Password and more.
We found that oauthmanager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.