Skip to content
emreb edited this page May 9, 2014 · 3 revisions

Requesting a key and QR code for new user

Request:

https://2stepforapps.appspot.com/register?app=testapplication&user=user%40user.com

Parameters:

  • app: Name of your application
  • user: Username for the user. (http encoded)

Response:

{
    "app": "testapplication",
    "user": "[email protected]",
    "key": "KY252ABW7ZWMDK4PZTGQ4OYY4QNYZXVPJZDGWWZKZPFIPVX5WYPNPALAWV2IKSXIO4EQGOFDP4YLG7UZ",
    "url": "http://chart.apis.google.com/chart?cht=qr&chs=200x200&chld=L&choe=UTF-8&chl=otpauth://totp/testapplication:[email protected]%3Fsecret%3DKY252ABW7ZWMDK4PZTGQ4OYY4QNYZXVPJZDGWWZKZPFIPVX5WYPNPALAWV2IKSXIO4EQGOFDP4YLG7UZ"
}

It will return the same app and user name in your request along with a randomly generated key and URL for a QR code that can be processed with Google authenticator app.


Validating one time code

In order to validate one time code entered by the user you need to send the following request that includes the key and the user entered value

Request:

https://2stepforapps.appspot.com/verify?key=KY252ABW7ZWMDK4PZTGQ4OYY4QNYZXVPJZDGWWZKZPFIPVX5WYPNPALAWV2IKSXIO4EQGOFDP4YLG7UZ&token=sdf

Parameters:

  • key: User's key
  • token: Value generated by the Google Authenticator app

Response:

{
    "valid": false,
    "token": "123",
    "key": "KY252ABW7ZWMDK4PZTGQ4OYY4QNYZXVPJZDGWWZKZPFIPVX5WYPNPALAWV2IKSXIO4EQGOFDP4YLG7UZ"
}

It will return the token and the key submitted along with a valid field set to either true or false based on the validity of the token entered for the key at the time of submission.

Clone this wiki locally