A
A
AlexKrsk2017-06-02 17:33:52
Java
AlexKrsk, 2017-06-02 17:33:52

How to log in correctly through VKApiClient?

I can't figure out how to properly authorize via VKApi in the desktop application.
The documentation says -

TransportClient transportClient = HttpTransportClient.getInstance();
VkApiClient vk = new VkApiClient(transportClient); 
UserAuthResponse authResponse = vk.oauth()
    .userAuthorizationCodeFlow(APP_ID, CLIENT_SECRET, REDIRECT_URI, code)
    .execute();

UserActor actor = new UserActor(authResponse.getUserId(), authResponse.getAccessToken()); 
GetResponse getResponse = vk.wall().get(actor)
    .ownerId(1)
    .count(100)
    .offset(5)
    .filter("owner")
    .execute();

if APP_ID is clear where to get it, but with the rest of the parameters - CLIENT_SECRET, REDIRECT_URI, code, Google searched and there is not a single example of adequate what and how.
tell me please
PS and even if there is already a token formed by hands, can you log in somehow differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Mayorov, 2021-02-10
@Dmitry-Mayorov

Values ​​of the "Application ID" fields (in the documentation, it corresponds to the API_ID, app_id or client_id parameter) and "Secured key" (secret_key, client_secret).

Authorization methods:
OAuth authorization:
Client or server authorization based on the OAuth 2.0 protocol
Direct authorization:
For trusted applications, an alternative method is possible - direct authorization by user login
and password.

https://vk.com/dev/standalone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question