Login the user (if not already logged in) and authorize your application. Be sure to set your desired permissions and your appid before calling this.
permissions
appid