pyjwt

JWT encrypting payload in python? (JWE)

微笑、不失礼 提交于 2019-12-10 13:02:24
问题 According to RFC 7516 it should be possible to encrypt the payload/claim, called JWE. Are there any python libraries out there that support that? I've checked PyJWT, python-jose and jwcrypto but they all just have examples for signing with HS256 (JWS). Sorry if this is totally obvious, but when it comes to things involving crypto I'm extra cautious. 回答1: Both Jose and jwcrypto libraries can do JWE. For jose: claims = { 'iss': 'http://www.example.com', 'sub': 42, } pubKey = {'k':\ '-----BEGIN

Authenticating Google API with a service account using Python Oauthlib

橙三吉。 提交于 2019-12-06 10:25:09
问题 I do not want to use Google APIs Client Library for Python, but still want to access Google API in Python using Oauthlib. After creating a service account in Google developer console, I downloaded the json file with the information to authenticate then do the following: >>> import json >>> from oauthlib.oauth2 import ServiceApplicationClient >>> from requests_oauthlib import OAuth2Session >>> json_file = json.load(open("google-project-credentials.json")) >>> client_id = json_file['client_id']