Author Topic: Alexa and amazon echo skill  (Read 1337 times)

garagevibes

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: Alexa and amazon echo skill
« Reply #15 on: December 06, 2016, 05:32:36 pm »
Thanks guys for getting back to me, Yes phenigma if you could send over the details of the LMCE oauth2 server details ill get it integrated into that and ill ask polly for some git login details so I can store the code there.

I've created an interface for a central web api portal which is used an intermediate for web services to connect to so for the moment the system works a bit like the quick diagram I've attached.

So there are basically 2 Oauth2 servers in use 1 on the core and 1 one this new web portal the idea being that a number of different web services can connect through the same web portal and it will route the messages to the correct users core and a user can break the chain at either end at any point if they ever need to, this means also that any app we produce can hopefully be released in to the public store's.

Looking on the amazon developer console I believe i can add people as developers to my account if I have there email address so they can add the skill for testing and view the code behind it, the web portal site is simply a router I wanted to keep all the api itself on each users core so that updates and things will stay as they are and hopefully the site will never have to change.

Ive had the idea of including alexa as a voice service as well but thats another task once I have this one solved :)
                                 

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1647
    • View Profile
Re: Alexa and amazon echo skill
« Reply #16 on: December 06, 2016, 05:42:44 pm »
Awesome stuff!  I think you're right in line with conversations in the irc dev channel!  I'll get you some more info and a git account if polly/ochorocho hasn't been able to yet.  Send me a PM with your name/username/email and I'll get an account up.

Thanks!

J.

Sent from my Nexus 5 using Tapatalk


phenigma

  • LinuxMCE God
  • ****
  • Posts: 1647
    • View Profile
Re: Alexa and amazon echo skill
« Reply #17 on: December 06, 2016, 06:12:52 pm »
Okay the OAuth2 implementation that was chosen some time ago is described here: https://bshaffer.github.io/oauth2-server-php-docs/cookbook/

I believe the appropriate files are all packaged into the lmce package 'lmce-oauth2-server'.  "apt-get install lmce-oauth2-server" on a core.

This will install the OAuth2 files in /var/www/lmce-admin/include/OAuth2/ and two files "oauth2-server.php" and "oauth2-token.php" in /var/www/lmce-admin/.  When the package installs it creates the database and the appropriate tables.

That's as far as that has made it.  Anything can change as far as configs, etc.

J.

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1181
  • hrumpf!
    • View Profile
    • Mah Website
Re: Alexa and amazon echo skill
« Reply #18 on: December 06, 2016, 06:34:57 pm »
link to code?
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

garagevibes

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: Alexa and amazon echo skill
« Reply #19 on: December 06, 2016, 08:48:19 pm »
Haha hilarious it just so happens thats the exact oauth2 server scripts I've been using anyway so should be quite simple to change over to this and my steps to add in the database tables wont be needed either.

I'll just have to change some of the required paths, Ill give this a go and see how i get on once thats done ill upload all the code. I haven't contacted polly yet for a git account ill do that in a min.

cheers all.

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1647
    • View Profile
Re: Alexa and amazon echo skill
« Reply #20 on: December 06, 2016, 08:49:07 pm »
:D

Sent from my Nexus 5 using Tapatalk


garagevibes

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: Alexa and amazon echo skill
« Reply #21 on: December 07, 2016, 11:00:52 am »
Hi phenigma,

Ive removed the parts I've added and now installed the new built in OAuth2 server, it all went through fine but it doesn't look to have created the database? hunting through the code I can see there should now be a database called lmce_oauth2_db but I don't seem too be able to find it in my system? I can manually create it for the time being but just to give you a heads up.

Also in the 'oauth2-server.php' file there needs to be the following line added to the bottom otherwise you wont get refresh tokens given and that will be really rubbish if we have to relink our systems every hour when the token expires :) I set the refresh expiration to 14 days here this means that you will have to relink if no commands are sent for more that 14 days? This may want to be extended or made indefinitely.

Code: [Select]
// Add the "Refresh Token" grant type
$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage, array(
    'always_issue_new_refresh_token' => true,
'refresh_token_lifetime'         => 2419200
)));

Whats the best way of going about this just make all the changes need to make this work on these scripts and then upload then to git or zip them and post them? Or am I better just sending you each amendment, I don't think there are that many?

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1647
    • View Profile
Re: Alexa and amazon echo skill
« Reply #22 on: December 07, 2016, 02:16:34 pm »
Neato.  Definitely create an Issue in gitlab to track this stuff.  For minor changes you can simply pass the info or files to me.  I'll try to have a look at these initial issues when I get home from work later today.  Thanks!

J.