How can i generate a state token Skip to main content
https://support.okta.com/help/answers?id=9062a000000bmroqai&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Sonal RoutSonal Rout 

How can i generate a state token

James FloresJames Flores (Okta, Inc.)
Hi Sonal, 

I am afraid that statment is a bit vauge. Can you clarify which SDK you are using? I am assuming you are using an SDK of sorts or perhaps this is in the OIDC space. Nonetheless, your best starting point for SDK and OIDC related questions is http://developer.okta.com.

If this is regards to an API token then you can find more informaiton here, https://help.okta.com/en/prod/Content/Topics/Security/API.htm
Sonal RoutSonal Rout
Hi James, I am trying to use the OCTA API to Enroll Okta SMS Factor but getting an error due to the state token. Could you please help me here. Thanks and Regards, Sonal T: 972-453-7124 M: 1-972-948-3272
James FloresJames Flores (Okta, Inc.)
Can you post the full message here? In reviewing the documentation and testing in Postman it seems the token used is the normal API token as mentioned in the above link. This is the doucmentation on Enrolling in SMS via the API found here http://developer.okta.com/docs/api/resources/factors.html#enroll-okta-sms-factor

It shows the sample code of:

H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{
"factorType": "sms",
"provider": "OKTA",
"profile": {
      "phoneNumber": "+1-555-415-1337"
     }
}' "https://${org}.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors"

In which the API token aquired from the Okta tenant is set to the ${api_token} varaible. If you have done this already and verified your token is still valid and still see an error the full error posted here would be most helpful. 
Sonal RoutSonal Rout
Hi James, Thanks for your help. Could you please let me know what is the below highlighted value for the URL https://${org}.okta.com/api/v1/users/00u15s1KDETTQMQYABRL/factors" Below is my request I am trying. Url- https://dev-792487.oktapreview.com/api/v1/users/sonal.rout@dexmedia.com/factors Post data
James FloresJames Flores (Okta, Inc.)
This value (00u15s1KDETTQMQYABRL) is essentiall the user ID for the user. The API calls do not use email or UPN to find users, this is what you must specify the user ID. If you run a GET for the users in the org you should be able to pull this ID, http://developer.okta.com/docs/api/resources/users.html#get-user-with-id