question

frenchy84 avatar image
frenchy84 asked

regCode not found

Hi, I followed every steps of the Reference Implementation Guide precisely and I got the same error every time I tried running the client and pasting the url given by the client: https://localhost:3000/device/register/XXXXXXXXXXXXXXXXXXXXX in Chrome, Firefox or Internet Explorer, I get: "error: Registration code is invalid" On the server command window, I get: Listening on port 3000 auth.validate matched whitelisted url entering register regCode no found Failure: Registering device: InvalidRegistrationCode: Registration code is invalid name: 'InvalidRegistrationCode', message: 'Registration code is invalid', status: 401 What did I miss? Can anyone help? Thanks, Frenchy Message was edited by: frenchy84
alexa voice service
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

frenchy84 avatar image
frenchy84 answered
Alright so I tried re-generating the self-signed certificate for the server as documented. I went to \samples\service\ssl and deleted the old files and followed all the steps again from the Reference Implementation Guide. But I got an error in the final step when doing “keytool -import -v -trustcacerts -alias avs-companion-service -file server.crt -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -keypass changeit -storepass changeit”. From the command prompt: keytool error: java.lang.Exception: Certificate not imported, alias already exists java.lang.Exception: Certificate not imported, alias already exists at sun.security.tools.keytool.Main.addTrustedCert(Main.java:2644) at sun.security.tools.keytool.Main.doCommands(Main.java:1006) at sun.security.tools.keytool.Main.run(Main.java:340) at sun.security.tools.keytool.Main.main(Main.java:333)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

frenchy84 avatar image
frenchy84 answered
FIXED. My token alias was expired or corrupted. 1-I deleted it from the command prompt: keytool -delete -alias avs-companion-service -keystore %JAVA_HOME%\jre\lib\security\cacerts 2-Password to enter was "changeit" 3-Created a new one with: keytool -import -v -trustcacerts -alias avs-companion-service -file server.crt -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -keypass changeit -storepass changeit And everything worked fine.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

elstryan@Amazon avatar image
elstryan@Amazon answered
That's great! I'm glad you were able to resolve this and thank you for writing up these steps in case another developer runs into this.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

frenchy84 avatar image
frenchy84 answered
Oups forgot the " " on the previous message. Here's the correct command: 1-I deleted it from the command prompt: keytool -delete -alias avs-companion-service -keystore "%JAVA_HOME%\jre\lib\security\cacerts"
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

frenchy84 avatar image
frenchy84 answered
I've had the same error again and I realized I forgot to delete the old deviceSecret code and regcode IDs from the config.json before deleting the old alias: 1-Open \samples\javaclient\config.json 2-Delete ,"deviceSecret":"YYYYYYYYYYYYYYYY","regcode":"XXXXXXXXXXXXXXXXX" so it just looks like: {"pid":"my_device","serial":"123456","url":"https://localhost:3000"} 3-Save
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.