Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api-access issue #331

Closed
startailcoon opened this issue Jul 18, 2017 · 5 comments
Closed

api-access issue #331

startailcoon opened this issue Jul 18, 2017 · 5 comments
Labels

Comments

@startailcoon
Copy link

When trying to follow the guide for adding API Access to restricted APIs I end up having an EOF Error.

The documentation I followed was: http://docs.bitshares.eu/api/access.html

The API Access JSON File contains:

{
 "permission_map" :
 [
  [
   "startail",
   {
    "password_hash_b64" : "<hash>",
    "password_salt_b64" : "<salt>",
    "allowed_apis" : ["asset_api"]
   }
  ],
  [
   "*",
   {
    "password_hash_b64" : "*",
    "password_salt_b64" : "*",
    "allowed_apis" : ["database_api", "network_broadcast_api", "history_api"]
   }
  ]
 ]
}

config.ini

# JSON file specifying API permissions
api-access = "api-access.json"

The Resulting Error

19917ms th_a       db_management.cpp:99          reindex              ] Done reindexing, elapsed time: 4018.37112100000013015 sec
19957ms th_a       application.cpp:480           startup              ] 11 eof_exception: End Of File
unexpected end of file
    {}
    th_a  json.cpp:430 variant_from_stream
19957ms th_a       application.cpp:1024          startup              ] 11 eof_exception: End Of File
unexpected end of file
    {}
    th_a  json.cpp:430 variant_from_stream
rethrow
    {}
    th_a  application.cpp:480 startup
19958ms th_a       main.cpp:195                  main                 ] Exiting with error:
11 eof_exception: End Of File
unexpected end of file
    {}
    th_a  json.cpp:430 variant_from_stream
rethrow
    {}
    th_a  application.cpp:480 startup
@oxarbitrage
Copy link
Member

i reproduced the exact same error with no api-access.json created so the problem is the node can't find the file. solved it by creating file exactly as: http://docs.bitshares.eu/api/access.html and placing at the same folder as config.ini.

please make sure your api-access.json is located in the same directory as config.ini or you can use i think full path.

i am pretty sure the problem is around file location. hope it helps.

@startailcoon
Copy link
Author

startailcoon commented Jul 19, 2017

The issue is that the api-access.json file are not assumed to be in the same folder as the config.ini file. The code assumes to find this in the same space as the executable file.

So when I specified api-access = "api-access.json" and placed it in the same folder (witness_node_data_dir) I got this error.

Placing it in the root folder does not throw this error, but nothing specifies that the access json has been read and understood.

On a side note, it seems that it doesn't matter if the filename is inside quotes or not.

@abitmore
Copy link
Member

I can confirm that using a full path will work, because I am using this feature this way. I'm not sure where the file is designed to be, or how others are using it, so don't know whether changing the behavior or "fix" it will break any existed 3rd-party applications.

@oxarbitrage
Copy link
Member

i added a log to the startup when api-access is present in the config.ini or the command line:
#332
also sent pull request to update the documentation encouraging the use of full into the documentation: bitshares/docs.bitshares.org#12

@oxarbitrage
Copy link
Member

patch was merged, please check #332
issue will be closed in 24 hs if there is no objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants