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

Authentication failed, even though credentials were added #85

Closed
1vnt opened this issue Jun 8, 2022 · 1 comment
Closed

Authentication failed, even though credentials were added #85

1vnt opened this issue Jun 8, 2022 · 1 comment

Comments

@1vnt
Copy link

1vnt commented Jun 8, 2022

I get an error ({"callid":"62a0ce4ec1c32","message":"authentication failed"}) everytime I try calling an API function. I have set up my credentials.ini file like described in the comment.

fauxapi_auth() {

    fauxapi_apikey=${1}
    fauxapi_apisecret=${2}

    fauxapi_timestamp=`date --utc +%Y%m%dZ%H%M%S`
    fauxapi_nonce=`head -c 40 /dev/urandom | md5sum | head -c 8`

    # NB:-
    #  auth = apikey:timestamp:nonce:HASH(apisecret:timestamp:nonce)

    fauxapi_hash=`echo -n ${fauxapi_apisecret}${fauxapi_timestamp}${fauxapi_nonce} | sha256sum | cut -d' ' -f1`
    fauxapi_auth=${fauxapi_apikey}:${fauxapi_timestamp}:${fauxapi_nonce}:${fauxapi_hash}

    echo ${fauxapi_auth}
}

curl --header "fauxapi_auth: $(fauxapi_auth xxx xxx)" \
	'https://xxx/fauxapi/v1/?action=config_reload'

This is my script I use for testing (copied from the bash lib). Same thing happens with the python client.
Is there any possible fix? I tried reinstalling the package, restarting php and other web stuff and added a new api key

@1vnt
Copy link
Author

1vnt commented Jun 12, 2022

Sorry, was an issue with my local machines time sync (80+ seconds behind)

@1vnt 1vnt closed this as completed Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant