Iβm trying to follow the SmartApp Authentication guide but the code that is provided in the examples hits this error:
java.lang.RuntimeException: Metadata Error: Missing required page parameter 'name' @ line 42
Here is the code I have:
mappings {
path("/oauth/initialize") {action: [GET: "oauthInitUrl"]}
path("/oauth/callback") {action: [GET: "callback"]}
}
preferences {
page(name: "Credentials", title: "Sample Authentication", content: "authPage", nextPage: "sampleLoggedInPage", install: false)
}
def authPage() {
if(!state.accessToken) {
createAccessToken()
}
def redirectUrl = "https://graph.api.smartthings.com/oauth/initialize?appId=${app.id}&access_token=${state.accessToken}&apiServerUrl=${getApiServerUrl()}"
if(!state.authToken) {
return dynamicPage(name: "auth", title: "Login", nextPage: "", uninstall: false) {
section() {
paragraph "tap below to log in to the 3rd party service and authorize SmartThings access"
href url: redirectUrl, style: "embedded", required: true, title: "3rd Party product", description: "Click to enter credentials"
}
}
}
}
This error message is super confusing given that every page Iβve defined does already have a name
parameter specified. Could the error message be a red herring? Being new to this and just going through the initial guides, I canβt say I understand enough about the ecosystem to know what else could be wrong with the sample code (you would expect that if you copy+paste the code from the official documentation, it would work!).