He intentado utilizar oAuth en Google apps script para acceder a los datos de trello, pero parece que la API de OAuthService hace algunas suposiciones sobre el servicio de OAuth y que trello no funciona de esa manera.Script de aplicaciones de Google oauth connect no funciona con trello
El siguiente código funciona. Es el acceso a Twitter de conseguir (esto es de tutorial oauth de Google):
function authorizeToTwitter() {
var oauthConfig = UrlFetchApp.addOAuthService("twitter");
oauthConfig.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
oauthConfig.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
oauthConfig.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
oauthConfig.setConsumerKey(<CONSUMER KEY>);
oauthConfig.setConsumerSecret(<CONSUMER SECRET>);
var requestData = {
"method": "GET",
"oAuthServiceName": "twitter",
"oAuthUseToken": "always"
};
var result = UrlFetchApp.fetch("https://api.twitter.com/1/statuses/mentions.json", requestData);
}
El siguiente código me va a llegar al Trello "pulse OK para volver" página, pero Trello no sabe cómo redirigir hacia atrás, así que llegar a una página que le pide que copie manualmente pegar un token (Google, pero no me proporciona con un método de inserción de esa señal)
function authorizeToTrello() {
var oauthConfig = UrlFetchApp.addOAuthService("trello");
oauthConfig.setAccessTokenUrl("https://trello.com/1/OAuthGetAccessToken");
oauthConfig.setRequestTokenUrl("https://trello.com/1/OAuthGetRequestToken");
oauthConfig.setAuthorizationUrl("https://trello.com/1/OAuthAuthorizeToken");
oauthConfig.setConsumerKey(<CONSUMER KEY>);
oauthConfig.setConsumerSecret(<CONSUMER SECRET>);
var requestData = {
"method": "GET",
"oAuthServiceName": "trello",
"oAuthUseToken": "always"
};
var result = UrlFetchApp.fetch(
"https://api.trello.com/1/members/me/boards",
requestData);
}
traté de arreglar esto añadiendo manualmente la devolución de llamada redirección que Proporciono a twitter en el url de autorización
oauthConfig.setAuthorizationUrl("https://trello.com/1/OAuthAuthorizeToken?return_url=https://docs.google.com/macros"); //this is what the tutorial says I should provide to twitter
o
oauthConfig.setAuthorizationUrl("https://trello.com/1/OAuthAuthorizeToken?return_url=https://docs.google.com/macros/externaloauthcallback"); //this is what twitter actually calls when performing the oauth dance
Pero ambos no funcionan. ¿Estoy haciendo algo mal? ¿Me faltan algunos parámetros de configuración que debería proporcionar?
El error que hacía que este problema se ha solucionado. –