メニュー

Expand
ページを評価:

ユーザーアイデンティティとアクセストークン

In Twilio Conversations, an identity is unique to a User and may be signed in on multiple devices simultaneously.

For example, the identity "alice@example.com" for a given User will stay synchronized on a number of endpoints, including their iPhone, Android tablet and in-browser application. All destinations for the same User will receive identical Conversation and Message notifications, as well as display the same message history.

Determining User Identity

On the server, you must decide two things based on the token request that you received:

  1. who the User is
  2. what they should be allowed to do

To figure out who the user is (their identity), you might use your existing login system or identity provider. You can use session cookies, an API token, or whatever mechanism you use to secure API requests or pages today.

You might not care who a User is at all, and assign them a temporary identity. Who the User is, what is their role, and how you determine that will vary from application to application.

If you determine that the User should indeed be allowed to access your Conversations application, you must grant your User access to a Conversation and supply an identity. Here are the guidelines on how to generate JWT access tokens: Creating Access Tokens.

How many identities to use in Twilio Conversations

Twilio Conversations also uses identity to track monthly usage and generate accounting reports. Therefore, you should be mindful about provisioning a reasonable amount of unique identities. Reusing identities too frequently and keeping uniqueness low may cause conflicts in the User and application logic. On the other hand, using only random identities will result in a large number of redundant unique Users, which also impacts monthly billing.

Active Users in Conversations

Twilio Conversations tracks unique User identities each month, and each unique identity connecting to a Conversation Service will create a User record. During a calendar month, if a User registers activity, they are considered "active." The following activities register Users as "active Users":

  • User is created via the REST API
  • User is updated via the REST API
  • User authenticates via the SDK
  • User sends a Message from the SDK
  • User sends a Message from SDK
  • A Message is sent on behalf of a User from the REST API
  • User joins a Conversation via the SDK
  • User is added to a Conversation via REST API or SDK
  • User is removed from a Conversation via REST or SDK

To minimize costs related to active Users:

  • avoid creating the Conversations client object (in the SDK) until you are certain that the User wants to read/send messages
  • avoid unnecessary REST API updates to Users, such as changing User attributes

ページを評価:

ヘルプが必要ですか?

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

        
        
        

        フィードバックくださりありがとうございます!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        ステップ1

        Get link

        Get a free personal referral link here

        ステップ2:

        Give $10

        Your user signs up and upgrade using link

        ステップ3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more