Closed sibinx7 closed 7 years ago
The glue configuration schema for a plugin registration is:
{
plugin: {
register: <plugin_to_register>,
options: <plugin_options>
},
options: <registration_options>
}
Which translates into a hapi server call of:
server.register({register: <plugin_to_register>, options: <plugin_options>}, <registration_options>)
So if you follow bell's documentation, the mapping should become apparent.
Thanks @csrl
Can you give me an example with this
server.register(require('bell'), function (err) {
server.auth.strategy('twitter', 'bell', {
provider: 'twitter',
password: 'cookie_encryption_password_secure',
clientId: 'my_twitter_client_id',
clientSecret: 'my_twitter_client_secret',
isSecure: false // Terrible idea but required if not using HTTPS especially if developing locally
});
})
Can u give me one example with this.
Project use Glue.compose.bind() method than Glue.compose, second one, we can use callback
Glue.compose(manifest, options, (err,server) => {})
Glue.compose.bind
{
plugin: {
register: <plugin_to_register>,
options: <plugin_options>
},
options: <registration_options>
}
Thanks in advance ...
call server.auth.strategy in the compose callback that provides the 'server' object.
Glue.compose.bind(Glue, Manifest.get('/'), composeOptions, composeCallback)
when i add callback ,i got argument error
throw new Error(msgs.join(' ') || 'Unknown error'); ^ Error: Invalid number of arguments
What is the purpose of using bind? You'll get "Invalid number of arguments" error if you pass more than 3 arguments to compose, but from what you pasted you are not doing that. The only thing I can think is you are doing something else weird since you are using bind in the first place.
In any case, I can't reproduce the error:
$ node
> var Glue = require("./")
undefined
> var compose = Glue.compose.bind(Glue,{},{}, (err,server) => {console.log(err,!!server)})
[Function: bound ]
> compose()
undefined
> null true
>
You'll have to provide a minimal example that produces the error that I can test.
(edit: for completeness)
Feel free to reopen if you still have any question.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Where i can pass callback to register bell auth stractegy