--- Insert the access token into a data request url
-- Adds the header: "Authorization: Bearer {access_token}"
-- Adds the query parameter: "access_token={access_token}"
-- self: the loa object calling this function
-- url: the url where the data request will be sent
-- access_token[optional]: the token retrieved by the request_token call
-- data[optional]: table containing POST parameters
-- method[optional]: HTTP method "GET", "POST", etc.
-- headers[optional: default headers to be included in the request
function token_transport(self, url, access_token, data, method, headers)
    access_token=access_token or self.access_token
    headers.Authorization="Bearer " .. access_token
    local parts=u.parse(url)
    parts.query=(parts.query or '') .. "access_token=" .. access_token
    url=u.build(parts)
    return self:build_request(url, data, method, headers)
end

OAuth = require 'loa'
client = OAuth.new(
    "https://accounts.google.com/o/oauth2/auth",
    "https://accounts.google.com/o/oauth2/token",
    "https://www.googleapis.com/drive/v2",
    "Your Client ID",
    "Your Client Secret",
    token_transport
)
generated by LDoc 1.4.2