All Projects → zalando-stups → python-tokens

zalando-stups / python-tokens

Licence: other
Python library to manage OAuth access tokens

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to python-tokens

ertis-auth
Generic token generator and validator service like auth
Stars: ✭ 28 (+100%)
Mutual labels:  oauth2, bearer-tokens
Oauth
A library for performing OAuth Device flow and Web application flow in Go client apps.
Stars: ✭ 244 (+1642.86%)
Mutual labels:  oauth2
React Native Google Sign In
React Native Wrapper for Latest Google Sign-In OAuth SDK / API
Stars: ✭ 213 (+1421.43%)
Mutual labels:  oauth2
Arkid
一账通是一款开源的统一身份认证授权管理解决方案,支持多种标准协议(LDAP, OAuth2, SAML, OpenID),细粒度权限控制,完整的WEB管理功能,钉钉、企业微信集成等
Stars: ✭ 217 (+1450%)
Mutual labels:  oauth2
Express Starter
It's a hackathon-starter fork, but designed to use PostgreSQL by default (or MySQL)
Stars: ✭ 215 (+1435.71%)
Mutual labels:  oauth2
Pow assent
Multi-provider authentication for your Pow enabled app
Stars: ✭ 236 (+1585.71%)
Mutual labels:  oauth2
Microservice Scaffold
基于Spring Cloud(Greenwich.SR2)搭建的微服务脚手架(适用于在线系统),已集成注册中心(Nacos Config)、配置中心(Nacos Discovery)、认证授权(Oauth 2 + JWT)、日志处理(ELK + Kafka)、限流熔断(AliBaba Sentinel)、应用指标监控(Prometheus + Grafana)、调用链监控(Pinpoint)、以及Spring Boot Admin。
Stars: ✭ 211 (+1407.14%)
Mutual labels:  oauth2
Light Oauth2
A fast, light and cloud native OAuth 2.0 authorization microservices based on light-4j
Stars: ✭ 247 (+1664.29%)
Mutual labels:  oauth2
Hackathon Starter Kit
A Node-Typescript/Express Boilerplate with Authentication(Local, Github, Facebook, Twitter, Google, Dropbox, LinkedIn, Discord, Slack), Authorization, and CRUD functionality + PWA Support!
Stars: ✭ 242 (+1628.57%)
Mutual labels:  oauth2
Lock.swift
A Swift & iOS framework to authenticate using Auth0 and with a Native Look & Feel
Stars: ✭ 215 (+1435.71%)
Mutual labels:  oauth2
Php Jwt
Ultra lightweight, dependency free and standalone JSON web token (JWT) library for PHP5.6 to PHP8.0. This library makes JWT a cheese.
Stars: ✭ 214 (+1428.57%)
Mutual labels:  oauth2
Authlib
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.
Stars: ✭ 2,854 (+20285.71%)
Mutual labels:  oauth2
Unitygoogledrive
Google Drive SDK for Unity game engine
Stars: ✭ 236 (+1585.71%)
Mutual labels:  oauth2
Openiddict Samples
ASP.NET Core, Microsoft.Owin/ASP.NET 4.x and JavaScript samples for OpenIddict
Stars: ✭ 214 (+1428.57%)
Mutual labels:  oauth2
Authing
🔥Authing - IDaaS/IAM solution that can Auth to web and mobile applications.
Stars: ✭ 247 (+1664.29%)
Mutual labels:  oauth2
Aqueduct
Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
Stars: ✭ 2,412 (+17128.57%)
Mutual labels:  oauth2
Oauth2 Bundle
Symfony bundle which provides OAuth 2.0 authorization/resource server capabilities.
Stars: ✭ 215 (+1435.71%)
Mutual labels:  oauth2
React Oidc
A set of react components and HOC to make Oidc (Open ID Connect) client easy. It aim to simplify OAuth authentication between multiples providers.
Stars: ✭ 217 (+1450%)
Mutual labels:  oauth2
Api Security Checklist
Checklist of the most important security countermeasures when designing, testing, and releasing your API
Stars: ✭ 16,339 (+116607.14%)
Mutual labels:  oauth2
Spring Cloud Shop
spring cloud 版分布式电商项目,全力打造顶级多模块,高可用,高扩展电商项目
Stars: ✭ 248 (+1671.43%)
Mutual labels:  oauth2

Python Tokens

Build Status Code Coverage Latest PyPI version License

A Python library that keeps OAuth 2.0 service access tokens in memory for your usage.

Installation

$ sudo pip3 install --upgrade stups-tokens

Usage

import requests
import time
import tokens

# will use OAUTH2_ACCESS_TOKEN_URL environment variable by default
# will try to read application credentials from CREDENTIALS_DIR
tokens.configure(url='https://example.com/access_tokens')
tokens.manage('example', ['read', 'write'])
tokens.start()

tok = tokens.get('example')

requests.get('https://example.org/', headers={'Authorization': 'Bearer {}'.format(tok)})

time.sleep(3600) # make the token expire

tok = tokens.get('example') # will refresh the expired token
requests.get('https://example.org/', headers={'Authorization': 'Bearer {}'.format(tok)})

This library also allows reading tokens directly from a file. The token needs to be in a file name ${CREDENTIALS_DIR}/${TOKEN_NAME}-token-secret:

import tokens

# the environment variable CREDENTIALS_DIR must be set correctly
tokens.configure(from_file_only=True)
tokens.manage('full-access')
tok = tokens.get('full-access')

requests.get('https://example.org/', headers={'Authorization': 'Bearer {}'.format(tok)})

Local testing

The "tokens" library allows injecting fixed OAuth2 access tokens via the OAUTH2_ACCESS_TOKENS environment variable. This allows testing applications using the library locally with personal OAuth2 tokens (e.g. generated by "zign"):

$ MY_TOKEN=$(zign token -n mytok)
$ export OAUTH2_ACCESS_TOKENS=mytok=$MY_TOKEN
$ ./myapp.py # start my local Python app using the tokens library

Releasing

Uploading a new version to PyPI:

$ ./release.sh <NEW-VERSION>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].