{"_id":"5620feb740e2c30d0002a899","__v":6,"category":{"_id":"5624bbb785a31117001c5403","pages":["5653264657978b1700df716a","5655bcf8dd82540d00278c26","5655bfd81a06b61900c66873","5655c7c0a66be71700968dd7","5660588e4320a80d00bec124","56618ad455e4450d00e62b89","56f1685a2a85600e00ea3dca"],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":7,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-10-19T09:45:27.364Z","from_sync":false,"order":10,"slug":"2-factor-authentication","title":"2-factor authentication"},"parentDoc":null,"user":"54eb4fdedf7add210007b29b","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"project":"54eb50e5615ffc1900305a16","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-16T13:42:15.978Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Authorization\"\n}\n[/block]\nIn order to use Infobip 2-FA API, you have to be authorized. We support two types of authorization:\n\n - [Basic authorization](http://dev.infobip.com/docs/getting-started#authorization) used for **service configuration methods**.\n - [API key authorization](#api-key-authorization) used for **client side methods**.\n\n## API key authorization\n\nIn order to use a client side methods, you need a valid Infobip API key. \n\nIf you don't have an API key, you can create one using a [Generate API key method](doc:api-key-create).  When you receive your API key, you should put it in the header after the authorization method and space i.e. `\"App \"`.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Example:\",\n  \"body\": \"*API key:* e78d84e20207873482d160c1144f7d08-59304bb3-11fa\\n\\n**Authorization:** App e78d84e20207873482d160c1144f7d08-59304bb3-11fa\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Integration steps\"\n}\n[/block]\n 1. **Service configuration**\n\t a. Create and configure your 2FA application\n\t b. Create and configure your 2FA message\n\t c. Generate your API key in order to use Client side methods\n\t \n 2. **Client side methods**\n\t a. Generate and send PIN code\n\t b. Verify PIN code\n\t c. Resend PIN code\n\t d. Get PIN code status\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"You can also **get** and **update** all your 2FA applications and messages.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Application configuration details\"\n}\n[/block]\n##**PIN Time To Live**\n\nPIN time to live represents how long the PIN will be active after it is generated. Within this time frame PIN could be verified. After PIN time to live expires, verification will not be possible. The old PIN will be discarded and the new one should be required. \n\n*Default value:* **900.000 milliseconds** (15 minutes)\n\n>***Example:*** Client sets PIN time to live to 45 seconds. If user tries to verify PIN after 50 seconds, the error will occur because PIN time to live has expired. In order to proceed further, the new PIN should be required. \n\n##**PIN Attempts**\n\nPIN attempts represents the number of overall PIN verification requests for one application (service) from one phone number (MSISDN) regardless time interval. If the overall PIN attempts are exceeded, verification will not be possible. The old PIN will be discarded and the new one should be required.\n\n*Default value:* **10**\n\n>***Example:*** Client sets PIN attempts to 3. The user enters wrong PIN for 3 times. With the forth attempt he tries to verify the correct PIN, verification will not be possible because PIN attempts are exceeded. In order to proceed  further, the new PIN should be required. \n\n##**Verification Attempts**\n\nVerification attempts represents the number of PIN verification requests from one phone number (MSISDN) in a defined verification time interval. If the repeated PIN verification is required before the time interval expires, verification will not be possible. It is necessary that defined verification time interval expires so the PIN verification attempt could be required for the second time. \n\n*Default value:* **1**\n\n>***Example:*** Client sets the Verification attempts to 1 and the verification time interval to 3 seconds (explained in the next step). User can try to verify the PIN only once in a 3 seconds from one phone number (MSISDN). \n\n##**Verification Interval Length**\n\nVerification interval length represent a defined time interval in which there can be no multiple (or whatever *Verification Attempts* is set to) PIN verification attempts. If the repeated PIN verification is requested before the time interval expires, verification will not be possible. It is necessary that defined verification time interval expires so the PIN verification attempt could be processed next time. \n\n*Default value:* **3.000 milliseconds** (3 seconds)\n\n>***Example:*** Client sets Verification attempts to 1 and the verification time interval to 3 seconds. User can try to verify the PIN only once in a 3 seconds from one phone number (MSISDN).\n\n##**Initiation Attempts**\n\nInitiation attempts represents the number of requests for generating a PIN and sending an SMS to one phone number (MSISDN) in a defined time interval. If the PIN generation requests from one phone number exceed the initiation attempts for defined time interval, further initiation requests will not be processed. It is necessary that defined time interval expires so the new PIN generation request and SMS sending could be performed.\n\n*Default value:* **3**\n\n>***Example:*** Client sets the Initiation attempts to 3 and the time interval to 1 day (explained in the next step). User can require a PIN generation and receiving of an SMS on one phone number max 3 times in one day. \n\n##**Initiation Interval Length**\n\nInitiation interval length represents a time interval in which a defined number of initiation attempts for one phone number (MSISDN) can be realized. If the PIN generation requests from one phone number exceed the initiation attempts for defined time interval, initiation attempts will not be processed. It is necessary that defined time interval expires so the new PIN generation request and sending SMS could be performed.\n\n*Default value:* **86.400.000 milliseconds** (1 day)\n\n>***Example:*** Client sets the Initiation attempts to 3 and the Initiation interval length to 1 day. User can request PIN generation and receiving of SMS containing it, for one phone number, maximum 3 times in one day. \n\n------\n### **Next:** [Create your first application](doc:application-create).","excerpt":"This tutorial is the overview of 2FA integration process","slug":"step-by-step-integration","type":"basic","title":"Step by step integration"}

Step by step integration

This tutorial is the overview of 2FA integration process

[block:api-header] { "type": "basic", "title": "Authorization" } [/block] In order to use Infobip 2-FA API, you have to be authorized. We support two types of authorization: - [Basic authorization](http://dev.infobip.com/docs/getting-started#authorization) used for **service configuration methods**. - [API key authorization](#api-key-authorization) used for **client side methods**. ## API key authorization In order to use a client side methods, you need a valid Infobip API key. If you don't have an API key, you can create one using a [Generate API key method](doc:api-key-create). When you receive your API key, you should put it in the header after the authorization method and space i.e. `"App "`. [block:callout] { "type": "success", "title": "Example:", "body": "*API key:* e78d84e20207873482d160c1144f7d08-59304bb3-11fa\n\n**Authorization:** App e78d84e20207873482d160c1144f7d08-59304bb3-11fa" } [/block] [block:api-header] { "type": "basic", "title": "Integration steps" } [/block] 1. **Service configuration** a. Create and configure your 2FA application b. Create and configure your 2FA message c. Generate your API key in order to use Client side methods 2. **Client side methods** a. Generate and send PIN code b. Verify PIN code c. Resend PIN code d. Get PIN code status [block:callout] { "type": "info", "title": "Note:", "body": "You can also **get** and **update** all your 2FA applications and messages." } [/block] [block:api-header] { "type": "basic", "title": "Application configuration details" } [/block] ##**PIN Time To Live** PIN time to live represents how long the PIN will be active after it is generated. Within this time frame PIN could be verified. After PIN time to live expires, verification will not be possible. The old PIN will be discarded and the new one should be required. *Default value:* **900.000 milliseconds** (15 minutes) >***Example:*** Client sets PIN time to live to 45 seconds. If user tries to verify PIN after 50 seconds, the error will occur because PIN time to live has expired. In order to proceed further, the new PIN should be required. ##**PIN Attempts** PIN attempts represents the number of overall PIN verification requests for one application (service) from one phone number (MSISDN) regardless time interval. If the overall PIN attempts are exceeded, verification will not be possible. The old PIN will be discarded and the new one should be required. *Default value:* **10** >***Example:*** Client sets PIN attempts to 3. The user enters wrong PIN for 3 times. With the forth attempt he tries to verify the correct PIN, verification will not be possible because PIN attempts are exceeded. In order to proceed further, the new PIN should be required. ##**Verification Attempts** Verification attempts represents the number of PIN verification requests from one phone number (MSISDN) in a defined verification time interval. If the repeated PIN verification is required before the time interval expires, verification will not be possible. It is necessary that defined verification time interval expires so the PIN verification attempt could be required for the second time. *Default value:* **1** >***Example:*** Client sets the Verification attempts to 1 and the verification time interval to 3 seconds (explained in the next step). User can try to verify the PIN only once in a 3 seconds from one phone number (MSISDN). ##**Verification Interval Length** Verification interval length represent a defined time interval in which there can be no multiple (or whatever *Verification Attempts* is set to) PIN verification attempts. If the repeated PIN verification is requested before the time interval expires, verification will not be possible. It is necessary that defined verification time interval expires so the PIN verification attempt could be processed next time. *Default value:* **3.000 milliseconds** (3 seconds) >***Example:*** Client sets Verification attempts to 1 and the verification time interval to 3 seconds. User can try to verify the PIN only once in a 3 seconds from one phone number (MSISDN). ##**Initiation Attempts** Initiation attempts represents the number of requests for generating a PIN and sending an SMS to one phone number (MSISDN) in a defined time interval. If the PIN generation requests from one phone number exceed the initiation attempts for defined time interval, further initiation requests will not be processed. It is necessary that defined time interval expires so the new PIN generation request and SMS sending could be performed. *Default value:* **3** >***Example:*** Client sets the Initiation attempts to 3 and the time interval to 1 day (explained in the next step). User can require a PIN generation and receiving of an SMS on one phone number max 3 times in one day. ##**Initiation Interval Length** Initiation interval length represents a time interval in which a defined number of initiation attempts for one phone number (MSISDN) can be realized. If the PIN generation requests from one phone number exceed the initiation attempts for defined time interval, initiation attempts will not be processed. It is necessary that defined time interval expires so the new PIN generation request and sending SMS could be performed. *Default value:* **86.400.000 milliseconds** (1 day) >***Example:*** Client sets the Initiation attempts to 3 and the Initiation interval length to 1 day. User can request PIN generation and receiving of SMS containing it, for one phone number, maximum 3 times in one day. ------ ### **Next:** [Create your first application](doc:application-create).