Requesting an OAuth token using the confirmation code
If you use a confirmation code from the user to obtain an OAuth token, the authorization in your app should be performed in two steps:
-
Receiving a confirmation code from the user and passing the code to Yandex OAuth.
-
Exchanging a confirmation code for an OAuth token depending on the method for obtaining the verification code.
Tip
If you are developing or testing the app, you can use a debug token. You don't need a verification code to get a debug token.
How to get a confirmation code
To request a confirmation code to exchange for an OAuth token, choose one of the following methods:
-
If you can set up automatic extraction of information from URLs in your app, extract the confirmation code from the redirect URL:
Getting a confirmation code from a URL -
If it's difficult to get the redirect URL in the app, request the code output on the browser page. This method is suitable for console apps when the user can open the browser and use the keyboard to enter the code they see:
Receiving a confirmation code from the user -
If the user can't use a browser or it's difficult to enter a code on the device, you can ask the user to enter the code in Yandex OAuth. This method is suitable for apps that run on multimedia devices, such as Smart TV:
Entering the code on the authorization page Yandex OAuth