Back to ApiBuilder Support

rakesh.jha0563974
rakesh.jha0563974

Hello Support,

I bought the ApiBuilder plugin and configured everything explained in video and created api. Now I am trying to execute it with secret key but it always throwing error {"error":"token_not_provided"} Please suggest what is going wrong. Regards, Rakesh Jha

emmanuel.makgabo14416
emmanuel.makgabo14416

Hi, you need to provide token as a query param like example below: Create new model (POST)

POST /api/v1/events?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3QvYXBpL2xvZ2luIiwiaWF0IjoxNTg1NDA4MDUxLCJleHAiOjE1ODU0MTE2NTEsIm5iZiI6MTU4NTQwODA1MSwianRpIjoiSnNrWUtnWVIxcThYS3pJcyJ9.8i2VI1Edn4sZAXMu9j6a7ZjB6FzppeRqoPp1OI3Tw1c HTTP/1.1
Content-Type: application/json

{
    "description": "hello world",
    "price": 110,
    "event_date": "2020-05-08 14:00:00"
}
rakesh.jha0563974
rakesh.jha0563974

Hello, I am doing the same but getting error "{"error":"token_not_provided"}"

Please see below api call

https://smsoftwares.com/projects/api/v1/add-item?token=TfGZRbOsk08T72te9uLYQTIV9vDx09zn&name=test&type=quickshot

Please let me know how this can be fixed?

Last updated

emmanuel.makgabo14416
emmanuel.makgabo14416

Hi You are getting the error because the token structure of ur token is wrong. The token structure expected is: string1.string2.string3

If you try the link below, you will invalid token error:

https://smsoftwares.com/projects/api/v1/add-item?name=test&type=quickshot&token=eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiJkYTdhNzJmZi0zOWVkLTQzNjYtYmE3MC1jOGI4ODZlNmY4NmUifQ.eyJ2ZXIiOjcsImF1aWQiOiI3YTlkOWNiNDA3ZTNmNzkwNjMwZjE5YTllOTE4ODM2YSIsImNvZGUiOiJKWXA2MlluTFcwX2tQSGJFZlZwUlkyU2wxSGNDTXFNWFEiLCJpc3MiOiJ6bTpjaWQ6UHRtMExrTTNUZnEzdmJ2YmVReUhTZyIsImdubyI6MCwidHlwZSI6MCwidGlkIjowLCJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiJrUEhiRWZWcFJZMlNsMUhjQ01xTVhRIiwibmJmIjoxNjE1NDUxODExLCJleHAiOjE2MTU0NTU0MTEsImlhdCI6MTYxNTQ1MTgxMSwiYWlkIjoiTmplZ3lESzRSMnF0WnJJQ0Vpc2E5USIsImp0aSI6IjZkYzE1ZDEzLTE1OGEtNDFhOC04ODViLTE2Njc2OGZkZjkyYyJ9.veJrGBFR--YjGBrPGph40_zVrNHos1ovPM-AyFpukb6sKVhDDPpGfK4bTVtt9C2PxyycPfE92dCdMv-Pogq2ew

You need to login to the api to get a valid token and then use that token for your subsequent requests.

POST /projects/api/login
{
    "email": "use@domain.com",
    "password": "password"  
}

Then you will receive a token like the one below:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjMsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3QvcHJvZC9hcGkvbG9naW4iLCJpYXQiOjE2MTY1OTE5OTksImV4cCI6MTYxNjU5NTU5OSwibmJmIjoxNjE2NTkxOTk5LCJqdGkiOiJrbzkyRXljZ3NjNGx2NzhGIn0.8DWo52GGnrj0ueq2r8cquF5_29mQ4G7Cbp4rK_McpXE

This token has three parts separated by dots/period/full stop
rakesh.jha0563974
rakesh.jha0563974

Hello, Thank you for the quick response. I am trying to run login api as per your suggestion but getting "Auth guard [] is not defined."

Please suggest the solution.

emmanuel.makgabo14416
emmanuel.makgabo14416

Hello

It seems you have other issues. You are welcome to contact me directly for further assistance. I'll be happy to help.

1-6 of 6