Hi,
I want to make a simple app with Scriptable, something more than ajust a widget or automation but still not a full-fledged app. I need my application to authorize to a third-party API with Oauth 2, so I have performed the flow but I don’t receive my authorization code in the args.queryParameters array. Here’s my test code
let params = args.queryParameters
Safari.open(authorizationInitURL)
if (params.code == null) {
let a = new Alert()
a.title = "Test"
a.message = args.queryParameters.join
await a.presentAlert()
}
No matters if I use params (the variable I defined), or call args.queryParameters directly, there’s nothing! Even when I try to enter some dummy params by hand, like
scriptable:///run/Test?a=b&c=d, it still does not work. Am I doing something wrong or there’s a bug?
There is also URLScheme.forRunningScript(), which gives you the URL to directly start the script. It returns the same as @cvp wrote but dynamically for the current script.