syscaller
Active Member
Hi, im currently working on API implementations for different platforms like spotify, youtube and google. Ive tried something like this:
Which doesn't work right now, because the URL-API is currently not implemented, i guess. Or is there some secret way to import it? Would be nice if this (or some other tool for uri manipulation) could be avaiable in the engine
Maybe you can take the implementation from Chromium.
JavaScript:
function getOAuthURL(state = "", scope = [], show_diag = false) {
var redirect = store.get('redirect_uri');
if (!redirect) throw Error('There is no host saved. Please click on the script-link in the settings.');
var redirect_uri = new URL(redirect)
var client_id = config.client_id;
if (!client_id) throw Error('Please specify a the client_id in the settings');
redirect_uri.searchParams.append('bot',engine.getBotID())
redirect_uri.searchParams.append('instance',engine.getInstanceID())
var spotifyURL = new URL('https://accounts.spotify.com/authorize');
spotifyURL.searchParams.append('client_id',client_id);
spotifyURL.searchParams.append('response_type','code');
spotifyURL.searchParams.append('redirect_uri',redirect_uri.href)
if(state) spotifyURL.searchParams.append('state',state);
if(scope.length) spotifyURL.searchParams.append('scope',scope.join(' '))
if(show_diag) spotifyURL.searchParams.append("show_diag", show_diag.toString());
return spotifyURL.href;
}
Which doesn't work right now, because the URL-API is currently not implemented, i guess. Or is there some secret way to import it? Would be nice if this (or some other tool for uri manipulation) could be avaiable in the engine

Maybe you can take the implementation from Chromium.
Last edited: