Can't blink Photon LED from Smartthings App


I am just trying to toggle the D7 Led using smartthings app. I have the following code for the photon below.

int ledToggle(String command);
int led = D7; 
void setup() 
  Particle.function("ledstate", ledToggle);    
  pinMode(led, OUTPUT);
void loop()

int ledToggle(String command)
  if (command == "1") {   
    digitalWrite(led, HIGH);   
    return 1;
  } else {               
    digitalWrite(led, LOW);    
    return 0;

The code for the device handler is written below.

preferences {
    input("token", "text", title:"Access Token")
    input("deviceID", "text", title:"Device ID")
metadata {
	definition (name: "Photon", author: "calmraptor") {
    	capability "Switch"
	tiles {
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "on", label: '${name}', action: "", icon: "st.switches.switch.on", backgroundColor: "#79b821"
		state "off", label: '${name}', action: "switch.on", icon: "", backgroundColor: "#ffffff"

		main "switch"
		details "switch"

def parse(String description) {
	log.error "This device does not support incoming events"
	return null

def on() {
		uri: "${deviceId}/ledstate",
        body: [access_token: token, command: '1'],  

def off() {
		uri: "${deviceID}/ledstate",
        body: [access_token: token, command: '0'],  

In Devices on the Smartthings IDE, I have put in the DeviceID and the token which I got from ‘particle token create’.

When I click the ‘on’ button in smartthings app, I get the following error on the IDE saying Unauthorized @line -1 (off)

There were others in the community that did the same thing as above, but I can’t seem to get rid of my error.