bonfire error 500 when sending data to controller - php

I keep getting this error for a bonfire application that I am trying to learn for the first time. I primarily know Codeigniter and bonfire is derived from it so I should be able to do anything I can do in CI here in bonfire.
I am trying to send data from a view to a controller via HTML Forms and this keeps showing up. I am going nuts with this error, I cannot even trace what's giving it out.
An Error Was Encountered
The action you have requested is not allowed. You either do not have access, or your login
session has expired and you need to sign in again.
Can somebody who knows how to use bonfire help me? It seems to have a pretty bad documentation as of this posting.

Related

Sending a PUT request from PHP to Hubspot

This problem is really bugging me, i'm a hobby programmer who right now is trying to follow the simple instructions of Hubspots CRM API documentation.
I've managed to retrieve and POST information from and to Hubspot using cURL/PHP, but now i'm facing an update(PUT) and i can figure it out.
I'm trying to associate a "Deal" with a "Contact" inside the CRM, it seems to be so easy, just fire away a url? :)
The documentation on the API says:
Note: You only need to use this endpoint when updating existing deal records. If you are creating new deals, you can make these associations when creating the record by including the associations data as documented on the create deal page."
src: https://developers.hubspot.com/docs/methods/deals/associate_deal
Do i understand correctly, i tried to use this URL in my browser and expected an update to happen?
https://api.hubapi.com/deals/v1/deal/DEALID/associations/CONTACT?id=CONTACTID&hapikey=MyKey
The response i got in the browsers console was: 405 (Method not allowed).
I tried to fire the url though cURL aswell, but got lost right away because i dont really have any data to send in "CURLOPT" parameters, the data should, if i understand correctly be inside the endpoint url.
If you have any idea of what this hobby programmer doesnt understand, please reply :)
Kind regards,
Simon

Ionic 2 / Laravel 5.2 communication with the API

Im a mega newbie at Ionic 2 and Angular 2, but i have quite a bit of background in PHP.
I have built my API in Laravel 5.2, at the moment, i have a login URL as follows:
http://www.website.com/api/v1/login
Which obviously returns a token if login is successful.
I have also built a form in ionic 2 using CSS and HTML, which is in the default /app/pages/home/home.html
What i want to do is make the login form actual communicate with the API but i cant find any examples on how to do this in Ionic v2.0.0-beta.32
All i want to do is redirect to a blank page if successful or display an alert if it fails.
I would love if someone could give me a bit of a helping hand.
Respect.
I am not sure what exactly you mean with "make the login form actual communicate with the API".
If you mean the actual http communication you'd need to understand $http and Observables. If you search for those terms you will find plenty of information and examples.
If that is not what you mean please be more specific.
I've tried a similar solution connection laravel to ionic 2.
From what I've learned, after you connect to laravel, you'll get the token, and this token will be used in all the requests to laravel/api.
Check for jwt-auth and satelizer for the angular authentication.
Some links that may help:
https://scotch.io/tutorials/token-based-authentication-for-angularjs-and-laravel-apps
https://github.com/sahat/satellizer/tree/master/examples/ionic
The first one is to prepare the laravel part, the second for the ionic.
NOTE:: In the first link, I faced some issues and problems, not with the code, but with the reference links.
Ex:
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class
should be
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class
It's missing some backslashes.

oAuth request token issue Codeigniter/Magento2

Been going around in circles with this and not getting a definitive answer... The error I am facing is:
oauth_problem=Cannot+create+request+token+because+consumer+token+is+not+a+verifier+token
Everything is correctly set with regards to my oAuth request header and sending to magento path /oauth/token/request. I have, even though the documentation says it doesn't require it (but for testing) added the verifier string to the request...
Pasting the code in here would make for a very long post and the code is working fine albeit it seems something is missing? If I use the verifier string in the consumer key it gives me the following error instead:
oauth_problem=Consumer+key+is+not+the+correct+length
Does anyone have any nuggets of information that the following links are missing that's tripping me up?
http://devdocs.magento.com/guides/v2.0/howdoi/webapi/integration.html
http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-oauth.html#pre-auth-token
I have found this on github, some people have seemed to work it out but not forthcoming with the details of how? github
This error occurs if you already have a request token created in Magento DB table oauth_token (if you're like me and developing an app and raising requests over and over to test), clear this table of its entries (request and verify) before retrying and this error won't appear.
2020 UPDATE:
This answer is still valid. Sometimes you may need to clear the Magento cache also after clearing the oauth_token table entries.

URL passed as GET parameter gives 403 forbidden while integrating mTurk API

I am trying to integrate mTurk API in one of my sites. I am creating HIT and using EXTERNAL QUESTION, passing my custom PHP web page hosted on my server. Example- http://abc.com/submitanswer.php?var1=testname
Now, on mTruk site, on completion of the task by user, when the user wants to submit the work done to my site, mTurk calls url provided by me in EXTERNAL QUESTION parameter. Additionally, it adds one more parameter - "turkSubmitTo=https://workersandbox.mturk.com" in the url.
So, when request is made for the page it creates a problem and gives 403 - Forbidden. If I directly call this url, then even it gives the same error. But, if I alter any text in value of GET para - turkSubmitTo like : remove "h" from OR remove ":" or such change, the browser nicely displays the page, without any errors..
Tried all possible ways one can think off, there is nothing else left now!
Need help !!!
Thanks !
Varshesh..
It's a mod_security issue. If you're on hosting provider, you can ask them to provide an exception for you. If it's local, you probably have to do it yourself.

how to integrate Tank auth on a website?

I've installed codeigniter on my server and made Tank auth work fine, too. now I want to know how to access Tank auth from my php pages. do I have to use include function so the login is placed inside my original php page or there is a better way how to do that??
I also want to show the login and log out buttons on my php pages.
any idea or clue to achieve that?
Thanks
Update #1
I believe that I can't create Tank auth session out of codeigniter, so how can I integrate my php pages in this CMS? please correct me if I was wrong.
Ok, I'm also this time going to answer my own question since I found the solution. maybe it is not the best answer, but I made it work in my side. To make the Tank Auth system work on other pages, the pages have to be placed in View folder in codeigniter framework so that an admin can gives permissions to do whatsoever in order to access the pages. Also, from the controller folder pages have to be identified in the same Tank Auth controller page so that the system works together wih any new page. I tried to place the pages out of the framework, but it didn't work Codeiginiter can't define out source variables. I get a lot of error as a result of that. I hope anyone find this useful. Thanks.

Categories