Oauth skill¶
Enables identifying yourself using Open Authentication providers like Google, Facebook or Linkedin.
Overview¶
The Oauth skill is an extension on the Identity skill. It extends the identify
dialog with:
- a form for web capable front-ends;
- buttons for oauth authentication.
How to use¶
Since it is overwriting the identify
dialog from the identity
skill you don't need to change much, except for configuring the oauth providers you want to use. Create a file called integrations.yaml
. It doesn't matter in which folder and add for instance the following provider items:
-
provider: google
alias: google
description: Allow bot to retrieve e-mail address, name and profile picture
scope: email profile
context: user
-
provider: facebook
context: user
description: Allow bot to retrieve e-mail address, name and profile picture
scope: email
alias: facebook
-
provider: linkedin
context: user
description: Allow bot to retrieve e-mail address, name and profile picture
scope: r_liteprofile,r_emailaddress
alias: linkedin
Now run your bot and try the new identify dialog by saying .invoke identify
.
How to extend¶
You can easily change the way the form is rendered by redefining the form in the constant @bsqd_oauth_form_id
. For instance if you like to add phone to the form:
@bsqd_oauth_form_id %{
"caption" => "Contact details",
"height" => "compact",
"schema" => %{
"properties" => %{
"email" => %{"format" => "email", "title" => "Email", "type" => "string"},
"phone" => %{"title" => "Phone", "type" => "string"},
"first_name" => %{"title" => "First name", "type" => "string"},
"last_name" => %{"title" => "Last name", "type" => "string"}
},
"required" => ["first_name", "email"],
"type" => "object"
},
"ui_schema" => %{
"ui:order" => ["first_name", "last_name", "email", "phone", "message", "*"]
}
}
If you want to introduce new fields, you need to copy and extend the task prepare_identify_form
and build what ever you like. Make sure to copy and extend the task identify_from_form
as well to store or process the fields you added.
How it works¶
You can read more about oauth integration here.