Closed sim2511 closed 1 year ago
My response.json() (formated)
{'account': {'account_id': x user_id': x client_id': x client_trusted': False new_account': True tier': 'x' region': 'eu' account_verification_required': False phone_verification_required': False client_verification_required': True require_trust_client_device': True country_required': False verification_channel': 'phone' user': {'user_id': x country': 'x'} amazon_account_linked': True braze_external_id': 'x'} auth': {'token': 'x'} phone': {'number': '+' last_4_digits': 'x' country_calling_code': 'x' valid': True} verification': {'email': {'required': False} phone': {'required': True channel': 'sms'}} lockout_time_remaining': 0 force_password_reset': False allow_pin_resend_seconds': 90}
I also change my url https://rest-**e004.**immedia-semi.com/api/v3/accounts/{account_id}/homescreen but still unable to connect :(
Does client_trusted': False has any impact? How can I change this?
username = username_entry.get()
password = password_entry.get()
# login
data = {
"email": username,
"password": password,
"device_identifier": "****",
"client_name": "Simon's camera",
"reauth": True,
}
response = requests.post(f"https://rest-prod.immedia-semi.com/api/v5/account/login", json=data)
if response.status_code == 200:
auth_token = response.json().get("auth").get("token")
client_id = response.json().get("account").get("client_id")
account_id = response.json().get("account").get("account_id")
region = response.json().get("account").get("region")
tier= response.json().get("account").get("tier")
print(response.json())
else:
print("Failed to log in:", response.content)
# ask for the pincode
pincode = input("Enter pincode:")
# verify pin
data = {
"pin": pincode
}
headers = {'token-auth': auth_token}
response = requests.post(f"https://rest-{tier}.immedia-semi.com/api/v4/account/{account_id}/client/{client_id}/pin/verify", json=data, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print("Failed to verify pin:", response.content)
headers = {'token-auth': auth_token}
response = requests.get(f"https://rest-{tier}.immedia-semi.com/api/v3/accounts/{account_id}/homescreen", headers=headers)
if response.status_code == 200:
print(response.json())
else:
print("Failed to get data from homescreen:", response.content)
The solution is the code above
Hello,
I have trouble to connect to homescreen api, error i received (second block of my code) : {'message': 'Unauthorized Access', 'code': 101}. I use the token_auth I received from first block, what am i doing wrong ? Regards