Skip to content

Instantly share code, notes, and snippets.

@fisherevans
Last active April 22, 2020 12:20
Show Gist options
  • Save fisherevans/80f873b2055df9479390a308d9e5fa12 to your computer and use it in GitHub Desktop.
Save fisherevans/80f873b2055df9479390a308d9e5fa12 to your computer and use it in GitHub Desktop.
Okta SMS Factor - Remembered Verification

1. Create User

curl --request POST \
  --url https://dev-####.okta.com/api/v1/users \
  --header 'authorization: SSWS <TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "profile": {
    "firstName": "Jane",
    "lastName": "Doe",
    "email": "[email protected]",
    "login": "jdoe"
  }
}'

2. Create Set Password

curl --request POST \
  --url https://dev-####.okta.com/api/v1/users/00ua4t9ugYY0pDxkE4x6 \
  --header 'authorization: SSWS <TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "credentials": {
    "password": {
      "value": "SomePassword123"
    }
  }
}'

3. Create SMS Factor

curl --request POST \
  --url https://dev-####.okta.com/api/v1/users/00ua4t9ugYY0pDxkE4x6/factors \
  --header 'authorization: SSWS <TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "factorType": "sms",
  "provider": "OKTA",
  "profile": {
    "phoneNumber": "+18024482036"
  }
}'

Response shows that it's PENDING_ACTIVATION

>>> HTTP 200
{
  "id": "mbla4rvs8zLRuHLZN4x6",
  "factorType": "sms",
  "provider": "OKTA",
  "vendorName": "OKTA",
  "status": "PENDING_ACTIVATION",
  "created": "2020-04-22T12:09:20.000Z",
  "lastUpdated": "2020-04-22T12:09:20.000Z",
  "profile": {
    "phoneNumber": "+18024482036"
  }
}

4. Verify SMS Factor

curl --request POST \
  --url https://dev-####.okta.com/api/v1/users/00ua4t9ugYY0pDxkE4x6/factors/mbla4rvs8zLRuHLZN4x6/lifecycle/activate \
  --header 'authorization: SSWS <TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "passCode": "355946"
}'

Response shows that it's ACTIVE

>>> HTTP 200
{
  "id": "smsa4tpxfgU1jL3jj4x6",
  "factorType": "sms",
  "provider": "OKTA",
  "vendorName": "OKTA",
  "status": "ACTIVE",
  "created": "2020-04-22T12:09:56.000Z",
  "lastUpdated": "2020-04-22T12:09:56.000Z",
  "profile": {
    "phoneNumber": "+18024482036"
  }
}

5. Delete SMS Factor

curl --request DELETE \
  --url https://dev-####.okta.com/api/v1/users/00ua4t9ugYY0pDxkE4x6/factors/smsa4tpxfgU1jL3jj4x6 \
  --header 'authorization: SSWS <TOKEN>'

6. Re-create SMS Factor

curl --request POST \
  --url https://dev-####.okta.com/api/v1/users/00ua4t9ugYY0pDxkE4x6/factors \
  --header 'authorization: SSWS <TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "factorType": "sms",
  "provider": "OKTA",
  "profile": {
    "phoneNumber": "+18024482036"
  }
}'

Response shows that it's ACTIVE - even though activate is not true.

>>> HTTP 200
{
  "id": "smsa4tqlqf1YIQHuW4x6",
  "factorType": "sms",
  "provider": "OKTA",
  "vendorName": "OKTA",
  "status": "ACTIVE",
  "created": "2020-04-22T12:10:32.000Z",
  "lastUpdated": "2020-04-22T12:10:32.000Z",
  "profile": {
    "phoneNumber": "+18024482036"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment