メニュー

Configuring SSO and IdP in Flex

Twilio Flex integrates with your existing Identity Provider to authenticate users (agents, supervisors or administrators) and enable single sign-on (SSO). Flex allows for integration with any Identity Provider that supports SAML 2.0 (Such as Google, Active Directory, Okta, etc), enabling you to use your primary corporate account as the identity provider for Flex.

Definitions

  • Identity Provider (IdP) is a trusted entity that lets you enable single sign-on to access other websites or services such as Twilio Flex with a single login. Your users can keep using their corporate user identities without having to remember many passwords or having to retype passwords each time they access a different service connected to the same Identity Provider. An example Identity Provider is Okta.
  • Security Assertion Markup Language (SAML) - is an open standard for exchanging authentication and authorization data between parties, in particular, between an Identity Provider and a Service Provider. SAML is an XML-based markup language for security assertions (statements that service providers use to make access-control decisions). Twilio Flex uses SAML version 2.0.
  • Service Provider (SP) - Twilio Flex in this context is the service provider configured as an Application on an Identity Provider to enable single sign-on.

Configure your Identity Provider to support Twilio Flex

The steps to configure Flex as an application (Service Provider) within your Identity Provider will be different depending on which Identity Provider your organization uses. Below, you can find documentation required to set up Flex as a Service Provider in a few popular Identity Providers:

Identity Attributes and Flex Roles

Your Identity Provider can provide any number of claims (key-value pairs) to Flex. Four of these are mandatory: Unique ID/User ID, list of User's Roles, Full Name and Email. The Unique ID should be provided in the request header, so it's likely you won't need to explicitly set it.

Flex includes the following roles:

ロール 概要
admin Grants access to all of the pages in the UI. Admins can use the Flex Admin, Agent Desktop, Teams, Queue Stats, Dashboard, Analyse and also Questionnaires (Flex Insights features) and the Flex Dialpad (if enabled).
supervisor Grants access to Agent Desktop, Teams, Queue Stats and Dialpad (if enabled).
agent Grants access to Agent Desktop and Dialpad (if enabled)

The user data sent to Flex from the Identity Provider is stored in the TaskRouter Worker attributes. This allows you as the contact center developer to adapt the Flex UI using data about the logged in user from your Identity Provider. The Worker attributes created for the logged-in user are updated on every successful SSO login, so any changes to user data made in your Identity Provider will also be represented as worker attributes.

The Attributes can be divided into 3-categories.

  • Mandatory: The list of mandatory parameters required for Authentication and Authorization
  • Flex - Agent: These are parameters used by the Agent Desktop of Flex
  • Flex Insights: These parameters are highly recommended if you are using the Flex Insights capabilities of Flex

Attribute conversion and data types

By default, all attributes will be transformed as strings to TaskRouter attributes except for roles attribute which defaults to stringarray (comma as separator).

It is possible to state the attribute type in the attribute name as follows:

name[.type]

where type is one of {string | int | boolean | array | stringarray | intarray | booleanarray}

サンプル

属性名 Type Example Value
name.string 文字列 Mary
skill.int integer 1
sales.boolean boolean true
languages.stringarray String Array en,de,fr
skills.intarray Integer Array 1,2,3,4

Incorrectly defining the attribute type and value (example skill.int defined as "a" or skill.int defined as "1.23") will result in Flex throwing a - 400 Error invalid attribute format. No TaskRouter changes will be made if the attribute definition(s) are incorrect.

Note that roles is a special attribute that accepts a comma-separated list of roles and does not require casting to stringarray.

contact_uri Attribute

contact_uri is used by TaskRouter and Twilio Voice SDK to dequeue a call (additional information). By default, the call is dequeued to the worker's contact_uri attribute using Twilio's JavaScript Voice Client (example: client:userId). The contact_uri is automatically configured by Flex and does not need to be set within your Identity Provider. The specific identity value will be escaped to only include alphanumeric and underscore characters.

The incoming call can also be dequeued to a SIP interface (sip:someone@somedomain.com) or a phone number by setting contact_uri as a phone number (+14151112222 - E.164 format). To dequeue to these identities, the contact_uri should be set within your Identity Provider.

When dequeuing the call to an international number please ensure the destination country is enabled in Twilio Console > Programmable Voice > Calls and Geo Permissions.

Mandatory Attributes

属性名 Type Value / Example

roles

Stringarray

agent, admin

full_name

文字列

Bob Bobson

メール

文字列

john@company.com

Flex - Agent

属性 Type Value / Example

image_url

文字列

http://www.someurl.com/bob_bobson.jpg

Flex Insights

属性 Type Value / Example

department

文字列

セールス

メール

文字列

mary.smith@company.com

location

文字列

London

manager

文字列

Adam Shepherd

phone

文字列

+15555555555

roles

Stringarray

wfo.team_leader

team_id

文字列

1

team_name

文字列

Sales VIP

team_name_in_hierarchy

文字列

London,Sales,VIP

User Capacity

You can also define the TaskRouter capacity per channel via these attributes. For example, a new user added to Flex may be available for voice tasks and have a default chat capacity of 1. These can be modified using custom attributes:

属性 Type Value / Example

channel.voice.availability

boolean

false

channel.chat.capacity

integer

3

These special attributes can be formed for any of the TaskChannels that you have defined within your Flex TaskRouter Workspace.

FAQ

How does Twilio Manage Identities?

Each user that logs in to Twilio Flex via SAML Identity Provider will automatically become a Flex User.

Flex will also auto-provision a TaskRouter Worker for this identity - TaskRouter is at the core of Flex and is required to enable intelligent skills-based routing of tasks to Agents or Supervisors.

Whenever a user logs in to Flex, all claims passed are checked and updated if necessary, using the Identity Provider as the source of truth. If you would like to update a specific Worker attribute directly then please do not configure it in the Identity Provider claims/attributes.

Can I log into Flex using Identity Provider-initiated login? (ex: Okta tile)

Yes. The SSO Configuration in Twilio Console has an optional 'Default Redirect URL' field. When provided, this allows IdP-initiated login to route into Flex. If your agents use Flex from flex.twilio.com, then provide the login link listed in your SSO Configuration. For example:

https://flex.twilio.com/dancing-owl-1234

Otherwise, you would use your own self-hosted Flex URL.

How do I log in to a self-hosted domain?

For your security, all self-hosted domains must be registered with Twilio to enable SSO login. These Trusted Domains can be provided alongside your SSO Configuration within the Twilio Console. The following patterns can be used when providing a Trusted Domain:

example.com allows example.com but not email.example.com
flex.example.com allows flex.example.com but not example.com
*.example.com allows one.example.com or two.example.com, but not example.com or one.two.example.com
127.0.0.1 または ::1 allows the IP address

The * can only be used to wildcard subdomains. For example, example.*.com or example*.com are not supported.

Can I log into Flex Agent Desktop without an Identity Provider?

Yes, Twilio Console users (except those that are only Billing or Support roles within Console) have access to Flex. They can launch Flex from within the Twilio Console, and they will login with the Flex admin role. We recommend this approach for your admins and developers when your application is under development.

You can trigger the 'Login with Twilio' option in two ways:

  1. By selecting 'Launch Flex' from within the Twilio Console. This is available on the Flex Overview page.
  2. By selecting 'Login with Twilio' on the default Flex login view.

Runtime Login View

Option 1 will always log into Flex at flex.twilio.com. If you are self-hosting the Flex UI, this will not load your private destination.

Option 2 is available for self-hosted locations and for local development, such as logging into localhost when developing plugins.

As mentioned in the FAQ for logging into a self-hosted domain, you must register your destination as a Trusted Domain. Otherwise, both SSO login and the 'Login with Twilio' option will not work.

Loading the Flex login view

The login view only loads if you have not provided the sso attribute within your application configuration. If the sso attribute is provided (or you are using your flex.twilio.com Login Link), then you will bypass the login view and immediately trigger SSO login.

Can I use the SessionNotOnOrAfter attribute from my Identity Provider?

The SessionNotOnOrAfter attribute can be configured within your Identity Provider to ensure a maximum TTL (time-to-live) for an authenticated session. After the configured time, a user will be forced to authenticate within their Identity Provider in order to extend their session with connected applications.

We do not recommend using this attribute alongside Twilio Flex. When a user is logged into the Flex UI application, Flex will regularly refresh the user's Flex Token (the authenticated token which grants access to the UI). If the Identity Provider session expiration comes before the Flex Token's expected refresh period, Flex will be unable to refresh the user's session. Any active communications may be prematurely closed once the user's authentication expires, and the user will need to refresh the Flex application and re-authentiicate through their Identity Provider.

If you choose to use SessionNotOnOrAfter, you must use a value greater than 1 hour (the default TTL of the user's authenticated Flex Token). We recommend setting this value above the shift time for an agent (e.g. 8-10 hours), otherwise the agent may be logged out of Flex unexpectedly. Even if you use a long TTL, the user may be impacted if they first login to Flex mid-way through their active authenticated session.

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。