Results 1 to 2 of 2

Thread: how to solve it?

  1. #1
    Fresh Spawn
    Join Date
    Jun 2020
    Posts
    1

    how to solve it?

    import requests

    headers = {
    'authorization': 'My api token',
    'Accept': 'application/json'
    }


    def get_user():
    # this will get an account from the Clash of Clans API
    response = requests.get(
    'https://api.clashofclans.com/v1/players/%23PJC0JUG0V', headers = headers)
    user_json = response.json()
    print(user_json)

    # these functions will be called
    get_user()



    Than result is

    {'reason': 'accessDenied', 'message': 'Invalid authorization'}




    how i solve it

    I use home ip adress

  2. #2
    Trainee
    Join Date
    Sep 2019
    Location
    Finland
    Posts
    25
    Change:

    Code:
    headers = {
    'authorization': 'MyApiToken',
    'Accept': 'application/json'
    }
    to:

    Code:
    headers = {
    'authorization': 'Bearer MyApiToken',
    'Accept': 'application/json'
    }
    and it works i.e. add the Bearer word before your token.
    .NET Standard library for Clash of Clans API @ https://github.com/tparviainen/clashofclans

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •