Skip to content

Instantly share code, notes, and snippets.

@d1snin
Created May 2, 2022 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d1snin/019d5da296558687ee7e3cce9d6d21e5 to your computer and use it in GitHub Desktop.
Save d1snin/019d5da296558687ee7e3cce9d6d21e5 to your computer and use it in GitHub Desktop.

OAuth Authorization Dialog

In order to authorize a user, you need to redirect their browser to [https://oauth.vk.com/authorize](https://oauth.vk.com/authorize) by passing the following parameters:

  • client_id (required parameter) — The identifier of your application. redirect_uri (required parameter) — The address to which the user will be redirected after authorization (the domain of the specified address must correspond to the main domain in the application settings).
  • display (required parameter) — Specifies the type of display of the authorization page. The following options are supported:
    • page — authorization form in a separate window;
    • popup — pop-up window;
    • mobile — authorization for mobile devices (without using Javascript). If the user logs in from a mobile device, the mobile type will be used.
  • scope is the bit mask of the application's access settings, which must be checked during user authorization and requested if necessary.
  • response_type — The type of response you want to receive:
    • code — if you want to make requests from a third-party server (by default);
    • token — if you want to make requests from the client.

Request example:

https://oauth.vk.com/authorize?client_id=1&redirect_uri=http://example.com/callback&scope=12&display=mobile

Note. If you are developing a Standalone application and pass a token in the response_type parameter, then you must specify the address as the redirect_uri parameter [https://oauth.vk.com/blank.html](https://oauth.vk.com/blank.html) to which the authorization data will be transmitted. Please note that only in this case you will have the opportunity to use advanced methods of working with the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment