ADL_LRS icon indicating copy to clipboard operation
ADL_LRS copied to clipboard

OAuth 'Could not verify OAuth request'

Open cybercussion opened this issue 1 year ago • 0 comments

I've made a number of attempts to call xAPI/OAuth/initiate using a few different off the shelf OAuth 1.0a libraries.

For example -

// Dependencies
const request = require('request')
const OAuth = require('oauth-1.0a')
const crypto = require('crypto')

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

// Initialize
const oauth = OAuth({
    consumer: {
        key: 'f736064db682425f9fdc41c4db62cc08',
        secret: '4aBK3L9aYyliEp3w',
    },
    signature_method: 'HMAC-SHA1',
    hash_function(base_string, key) {
        return crypto
            .createHmac('sha1', key)
            .update(base_string)
            .digest('base64')
    },
})

const request_data = {
    url: 'https://127.0.0.1/xAPI/OAuth/initiate',
    method: 'POST',
    data: {oauth_callback: 'oob'}
}

// Note: The token is optional for some requests
// const token = {
//     key: 'd587c1612bbb4153a44c3a42d6ef6d5a',
//     secret: 'vWALvHvT6nWX9Swm',
// }

request(
    {
        url: request_data.url,
        method: request_data.method,
        form: oauth.authorize(request_data, ''), // token
    },
    function(error, response, body) {
        // Process your data here
        console.log('ERROR:\n' + error, response, body);
    }
)

All that comes back is "Could not verify OAuth request" and a DENY. Not much info on how to obtain temp token beyond that.

Is there a cleaner mechanism of proving this is functioning?

cybercussion avatar Feb 14 '23 22:02 cybercussion