a-know / Pixela

A service for generating GitHub-like graphs. Record and Track your habits or effort. All by API.
https://pixe.la
402 stars 26 forks source link

Token Authentication #19

Closed salimdason closed 3 years ago

salimdason commented 3 years ago

Issue with token authentication when creating an account. It returns the message: {"message":"The token string must be at least 8 characters and not more than 128 letters and numbers or alphanumeric characters or symbols.","isSuccess":false}

Regardless of what I use. PS: I know the Validation rule: [ -~]{8,128.

This is the token I have used: TOKEN = "khajbdvahdgy72y8his83"

a-know commented 3 years ago

@salimdason Thank you for reporting. But, I could not reproduce it. Would you paste the command when you tried to create an account?

salimdason commented 3 years ago

Hello @a-know, sure. I've tried using different configurations for the token but still no joy. I've included the code snippet. Thanks for taking a look.

import requests

Create User Account

USERNAME = 'usernameiused' TOKEN = "khajbdvahdgy72y8his83"

pixela_endpoint ="https://pixe.la/v1/users"

user_params = { "token": "TOKEN", "username": "USERNAME", "agreeTermsOfService": "yes", "notminor": "yes" }

response = requests.post(url=pixela_endpoint, json=user_params) print(response.text)

{"message":"The token string must be at least 8 characters and not more than 128 letters and numbers or alphanumeric characters or symbols.","isSuccess":false}

a-know commented 3 years ago

Hi @salimdason , thank you for detail.

Are you using Python or something else to run the Pixela API? I don't know Python well, but the following sections looks bad:

"token": "TOKEN",

TOKEN = "khajbdvahdgy72y8his83" is variable. So the user_params must be as follows, right? (And, USERNAME too.)

user_params = {
"token": TOKEN,
"username": USERNAME,
"agreeTermsOfService": "yes",
"notminor": "yes"
}

Please check this :)

salimdason commented 3 years ago

Hello @a-know nice looking out. I am using python. I just saw the error after you pointed it out. I was passing TOKEN and USERNAME as strings instead of variables. Sorry for the inconvenience, and thanks for catching the error.

a-know commented 3 years ago

@salimdason No problem at all. Don't worry about it. I am really glad that your problem is solved! 😄

And, thank you for using Pixela. I hope you continue to enjoy it! :)