PipedreamHQ / roadmap

Pipedream is an integration platform for developers. Have a feature request or bug to report? Add it here.
https://pipedream.com
30 stars 5 forks source link

SmugMug #472

Closed ogauk closed 4 years ago

ogauk commented 4 years ago

SmugMug

https://api.smugmug.com/api/v2/doc/tutorial/authorization.html

Can probably build the auth directly in an action.

Are there specific actions, or triggers, you'd like to see for this app? SmugMug Create Album #471

ogauk commented 4 years ago

Here is a working example

const crypto = require('crypto');
const OAuth = require('oauth-1.0a');
const axios = require('axios');

const oauth = OAuth({
    consumer: { key: process.env.SMUGMUG_KEY, secret: process.env.SMUGMUG_CLIENT_SECRET },
    signature_method: 'HMAC-SHA1',
    hash_function(base_string, key) {
        return crypto
            .createHmac('sha1', key)
            .update(base_string)
            .digest('base64')
    },
})
const token = {
    key: process.env.SMUGMUG_TOKEN,
    secret: process.env.SMUGMUG_TOKEN_SECRET
};
const request_data = {
    url: "https://api.smugmug.com/api/v2/folder/user/oga/Boats!albums",
    method: "POST"
};
let headers = oauth.toHeader(oauth.authorize(request_data, token));
headers = {
    'Authorization': headers.Authorization,
    'Content-Type': 'application/json',
    'Accept': 'application/json'
};
const config = { headers };
console.log(config);
const r = await axios.post(
    request_data.url,
    {
        UrlName: params.UrlName,
        Name: params.Name,
        Privacy: 2, 
        SecurityType: 1
    },
    config
)
console.log(r);
todsac commented 4 years ago

I have integrated SmugMug but am having some trouble testing with a free account. Would you be willing to confirm the integration is working?

todsac commented 4 years ago

I confirmed this integration works.

ogauk commented 4 years ago

It's great! Thanks for the speedy turn around. My create album action is here: https://pipedream.com/actions/a_0Mio3R/edit