Hapijs crumb plugin give me undefined crumb - plugins

I'm trying to use crumb plugin in my project to get a token crumb plugin
I have imported it as a plugin. In the jade template I get it in that way
input(type='hidden', name='crumb', value='#{crumb}')
but the value is undefined. Why I get that value? Should I set any settings? According to the examples of the developer, it seems so easy

When cors is enabled, crumb token isn't generated. The developer has updated in order to generate crumb when cors is true

Related

Aqueduct template db_and_auth not rendering login form

I am working on setting up OAuth 2.0 for aqueduct and want to start with a working example. The template db_and_auth is suppose to serve this purpose.
I have followed the readme instructions and connected my database and updated the migration. also I have registered OAuth 2.0 clients in the application database as the readme describes.
The template comes with a route in the channel.dart
router
.route("/auth/form")
.link(() => AuthRedirectController(authServer, delegate: this));
The AuthRedirectController is set up to render a html page (web/login.html) which is part of the template.
However every time I send a get request to this route it returns with a 400 error saying Error
unsupported_response_type in the browser. Additionally in the readme file it only shows testing auth end points using curl. Why would this template include a rendered login page without mention of it in the readme? Any help with this would be much appreciated.
The login form will only be rendered when you pass the correct response_type like so:
http://localhost:8888/auth/form?response_type=token

how to use "preconnect" and "dns-prefetch" with Axios

how can i fix this with Axios, Are there any parameters ?
axios.get('/slug', { params })
Preconnect to required origins
Consider adding preconnect or dns-prefetch resource hints to establish early connections to important third-party origins. Learn more.
why chrome audit declares this opportunity when this url does not exist in the source code
https://immobiliere-essaouira.graines-digitales.fr/
All resource hints can be used only as attributes on a <link> element. You can read about what they do and how for example here
So there is nothing you can do directly in JavaScript (except of course adding the attribute to existing link dynamically based on user action)
If your are requesting something using Axios from domain https://api.my-app.com, just including <link rel="preconnect" href="https://api.my-app.com" /> into your page should be enough...

How to set a field validity based in API response

I have an Angular 4 app with a registration form. On submission I get from the API the info where is set if the username or email is taken (server validation rules). I'm trying to find a way similar to the NgModelController in AngularJS $setValidity(validationErrorKey, isValid) to set the field validity for reactive forms but I can't. I just want to set the validation after API response.
For changing reactive form's input element's validation status manually(with custom error),
you can use setError() to change status to error:
this.form.controls.name.setErrors({'testError': true});
and clear errors by
this.form.controls.name.setErrors(null);
refer Plunker demo.

Yii2, Facebook and Twig

I'm trying to build a rather simple site, and my biggest hurdle is getting facebook login working.
I'm trying to use the authclient extension to log in with facebook. I've set everything up according to docs.. but I don't know how to initiate the process of logging in.
I've built a fb connect based on the sdk before and I'd really rather not...
Now my next question, how do I access template functions in twig and plugins through a twig template?
Such as this:
<?= yii\authclient\widgets\AuthChoice::widget([
'baseAuthUrl' => ['site/auth']
]); ?>
I've used cakephp before on a pretty big project, but I'm completely new to yii.
The twig integration isn't really the smoothest yet. You can register a namespace, and then there should be a *_begin and *_end function for twig, i.e.
{{ use('philippfrenzel/yii2masonry/Yii2masonry') }}
{{ yii2masonry_begin({
'clientOptions': {
'columnWidth' : 50,
'itemSelector' : '.item',
}
}) }}
Important is to note the json style of options, and the capitalization of the namespace and twig function.
Hope that helps :)

Instagram feed not returning any data

I'm using Instafeed.js for a client's site:
http://instafeedjs.com/
I've included the script, got my access token & userID. I obtained these by scrolling down to the 'Getting images from your User Account' section of the aforementioned page, and clicking the link at bottom: Don't know your user id or token? Click here to get one.
My code:
$(document).ready(function() {
var userFeed = new Instafeed({
get: 'user',
userId: clientsID,
accessToken: 'MY_ACCESS_TOKEN',
template: '<img src="{{image}}" />',
target: 'instafeed',
limit: 6
});
userFeed.run();
});
I've created an empty div with the 'instafeed' id. The div is being populated with 6 empty a tags, each with an empty image tag. I don't have any console errors.
In the instructions on this site, I'm told to
"make sure your token is set to basic authorization, which only allows
GET requests. If you aren't sure what scope your token has, check
under your account page."
On my account page, I have an 'Instafeed.js' application set up, but the only option I have is to revoke access. I cannot edit or see any other options, so I'm not sure if this could be related to the problem.
Any help would be greatly appreciated!
All tokens issues by the API are given the basic scope, unless the scope was specified in the authentication request.
From the Instagram API Docs:
Currently, all apps have basic read access by default. If all you want to do is access data then you do not need to specify a scope (the “basic” scope will be granted automatically).
You can verify which scope the token has by visiting the Manage Applications page. Each application will display what kind of access level it has. A basic permission set should say something like "Access your basic information":
So you shouldn't need to do anything to set the token's permissions, that's all handled when the token is created. If you used the helper link on instafeedjs.com to get that token, then all the permission levels should already be taken care of for you.
In case someone else runs into this issue, my problem was actually a conflict with Shopify's template engine. When I removed the template option everything worked fine, thanks to Steven here who actually responded to my email! This dude is killer.
In Shopify, if you drop the configuration script into a new "asset" labeled instafeed_config.js and then call it with
{{ "instafeed_config.js" | asset_url | script_tag }}
after loading
{{ "instafeed.min.js" | asset_url | script_tag }}
then you are able to use the Template feature.
You can adjust the template section.
Change the following:
img src="{{image}}"
To:
img src="http:{{image}}"