Skip to content

Instantly share code, notes, and snippets.

@srinivasanagandla-okta
Last active August 29, 2015 14:00
Show Gist options
  • Save srinivasanagandla-okta/10cbb5c8ce561a52902d to your computer and use it in GitHub Desktop.
Save srinivasanagandla-okta/10cbb5c8ce561a52902d to your computer and use it in GitHub Desktop.
Enroll & Activate, Verify Flow (For HOTP/TOTP)

Enroll & Activate, Verify Flow

Enroll & Activate

Request

POST /api/v1/users/00TmqQCMPRSYHBDHVWAN/factors HTTP/1.1
Host: your-subdomain.okta.com
Authorization: SSWS yourtoken
Accept: application/json
Content-Type: application/json
{
    "factorType": "totp",
    "provider" : "okta",
    "deviceType": "smartphone:ios",
    "profile": {
        "deviceName": "My Office IPhone"
    }
}

Response

HTTP/1.1 301 MOVED PERMANENTLY
Location: http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO
Content-Type: application/json
{
    "id" : "00ud4tVDDXYVKPXKVLCO",
    "factorType" : "totp",
    "status" : "ENROLLED",
    "created" : "2013-06-24T16:39:18.000Z",
    "activated" : "null",
    "lastVerification" : "null",
    "lastUpdated" : "2013-07-02T21:36:25.344Z",
     "profile": {
              "deviceName": "My Office IPhone"
      },
      "_embedded" : {
           "install" : {
               "appStore":<link-to-app>,
               "barCode":<link-to-bar-code-image>
           },
           "verify" : {
              "type" : "passcode",
              "count" : "1"
           }
      },
     "_links": {
        "next": {
              "name":"verify",
              "href":"http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO/lifecycle/verify",
            "hints": {
                "allow": ["POST"]
              }
         },
         "self": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO",
            "hints": { 
                "allow": ["GET", "DELETE"]
            }
          },
          "verify": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO/lifecycle/verify",
            "hints": {
                "allow": ["POST"]
              }
           },
           "user": {
              "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN",
              "hints": {
                "allow": ["GET"]
              }
           },
        "provider": {
            "href": "http://rain.okta1.com:1802/api/v1/factors/providers/okta",
            "hints": {
                "allow": ["GET"]
            }
         }
}

Verify Factor

Request

POST /api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO/lifecycle/verify HTTP/1.1
Host: your-subdomain.okta.com
Authorization: SSWS yourtoken
Accept: application/json
Content-Type: application/json
{
    "activationCode" : 738402
}

Response

HTTP/1.1 202 ACCEPTED
Content-Type: application/json
{
    "id": "00ud4tVDDXYVKPXKVLCO",
    "verificationStatus": "SUCCESS",
    "status": "ACTIVE",
    "_links": {
        "factor": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO",
            "hints": { 
                "allow": ["GET"]
                }
           }
      }
}

Get/Poll Status of the SMS Factor

GET /api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO HTTP/1.1
Host: your-subdomain.okta.com
Authorization: SSWS yourtoken
Accept: application/json
Content-Type: application/json

Response

{
    "id" : "00ud4tVDDXYVKPXKVLCO",   
    "factorType" : "totp",
    "status" : "ACTIVE",
    "created" : "2013-06-24T16:39:18.000Z",
    "activated" : "2013-06-24T16:41:18.000Z",
    "lastVerification" : "2013-06-24T16:40:18.000Z",
    "lastUpdated" : "2013-07-02T21:36:25.344Z",
     "_embedded" : {
          "profile": {
              "deviceName": "My Office IPhone"
           }
      },
     "_links": {
        "self": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO",
            "hints": { 
                "allow": ["GET", "DELETE"]
            }
        },
        "deactivate": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN/factors/00ud4tVDDXYVKPXKVLCO/lifecycle/deactivate",
            "hints": {
                "allow": ["POST"]
            }
        },
        "user": {
            "href": "http://rain.okta1.com:1802/api/v1/users/00TmqQCMPRSYHBDHVWAN",
            "hints": {
                "allow": ["GET"]
            }
        },
        "provider": {
            "href": "http://rain.okta1.com:1802/api/v1/factors/providers/00TmqQCMPRSYHBDHVWAN",
            "hints": {
                "allow": ["GET"]
            }
         }    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment