You are viewing a single comment's thread from:

RE: Hivesigner UI: 1-click login

in HiveDevs3 years ago

hi guys im getting erors in python hivesigner api i am trying to send custom json operation with ouath2 or another thing but im getting some eror every time i give active permisson to app my secret is true aacces token is valid if i do
curl -H "Authorization: ACCESS_TOKEN" https://hivesigner.com/api/me
its work
get acces token : {'error': 'invalid_grant', 'error_description': 'The token has invalid role'}
post info : Status Code: 401, Response: {'error': 'invalid_grant', 'error_description': 'The token has invalid role'}
client broadcast : {'error': 'invalid_grant', 'error_description': 'The token has invalid role'}

the python code :
from hivesigner.client import Client
import requests
from hivesigner.operations import CustomJson

hive api : https://docs.hivesigner.com/h/guides/get-started/hivesigner-oauth2

hive python client api

c = Client(
access_token='token',
client_id="send",
client_secret='secret',
)

x =c.get_login_url(
"https://example.com/callback",
"custom_json,vote,offline",
get_refresh_token=True,
)
q = c.get_access_token(
'token',
)
print('get acces token : ' , q)
r = requests.post('https://hivesigner.com/api/broadcast', json={
"Authorization": "",
"Content-Type": "application/json",
"Accept": "application/json",
"Body": {"required_auths":["damble"],"required_posting_auths":[],"id":"sm_gift_cards","json":"{"to":"rashand","cards":["C7-401-LWSLAJ030G"]}"}
})

print(f"post info : Status Code: {r.status_code}, Response: {r.json()}")
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------#
json_structure = {"required_auths":["rashand"],"required_posting_auths":[],"id":"sm_gift_cards","json":"{"to":"rashand","cards":["C7-401-LWSLAJ030G"]}"}
custom_json = CustomJson(
'damble',
'',
'sm_gift_cards',
json_structure,
)
print('client broadcast : ',c.broadcast([custom_json.to_operation_structure()]))