# encoding: utf-8
# frozen_string_literal: true
api_version = '5.67'
redirect_uri = 'https://oauth.vk.com/blank.html'
display = 'page'
response_type = 'code'
state = 'foo'
# group_id
$stdout.write 'group_id: '
group_id = gets.to_i
abort "wrong group_id: #{group_id}" if group_id.zero?
# app_id
$stdout.write 'app_id: '
app_id = gets.to_i
abort "wrong app_id: #{app_id}" if app_id.zero?
# app_secure_key
$stdout.write 'app_secure_key: '
app_secure_key = gets.chomp
# scope
$stdout.write 'scope (comma separator): '
scope = gets.chomp
# code
$stdout.write "open https://oauth.vk.com/authorize?client_id=#{app_id}&redirect_uri=#{redirect_uri}&display=#{display}&scope=#{scope}&response_type=#{response_type}&v=#{api_version}&state=#{state} in browser\n"
$stdout.write 'code: '
code = gets.chomp
$stdout.write "open https://oauth.vk.com/access_token?client_id=#{app_id}&client_secret=#{app_secure_key}&redirect_uri=#{redirect_uri}&code=#{code} in browser\n"
$stdout.write "Enjoy your access_token!\n"
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.