alex-phillips / clouddrive-php

Amazon Cloud Drive API and CLI for PHP
MIT License
36 stars 9 forks source link

Client id and secret #15

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, been at this for hours and cant get the client id and secret to auth correctly. I have figured out where to go on the amazon developer console to create a security profile and I have an client id and secret, but everytime I run clouddrive init it redirects to http://localhost/?error_description=lwa-invalid-parameter-bad-scope&error=invalid_scope which is my localhosts nginx page?

I really would like to use this, any advice on the exact process to get client id and secret setup would be useful.

Also might be worth updating the readme to include a bit of info about the sym link for composer bin so its global and that you might need to install php5-sqlite.

Please help, thanks.

alex-phillips commented 8 years ago

@timrabbetts This is a common issue I also need to put in the README. Depending on when you "created" your app and received the Amazon credentials, the scope used by your app may be different that what is set by default in the code. (You can change the scope via the setScopes method), but a super easy workaround is that for the auth URL that you paste into your web browser, simply modify the scope string where it says "&scope=...". If the scope contains "read_all", just change this to "read".

Let me know if this doesn't solve your issue.

alex-phillips commented 8 years ago

Closing this issue. If my suggestion didn't solve it, please reopen the ticket.

gradosevic commented 8 years ago

Hi, I have the same problem with the same error message. This is my URL https://www.amazon.com/ap/oa?client_id=[CLIENT_ID]&scope=clouddrive%3Aread_all%20clouddrive%3Awrite&response_type=code&redirect_uri=http://localhost

I tried also setting the scope to 'read' but still no luck: https://www.amazon.com/ap/oa?client_id=[CLIENT_ID]&scope=read&response_type=code&redirect_uri=http://localhost

Thanks

therealssj commented 8 years ago

@gradosevic you might want try to this pattern https://www.amazon.com/ap/oa?client_id=CLIENT_ID&scope=clouddrive%3Aread%20clouddrive%3Awrite&response_type=token&redirect_uri=http://localhost

gradosevic commented 8 years ago

Thanks for the idea. Unfortunately that didn't worked. I've found an answer for this issue on a forum telling that an app must be correctly created and whitelisted fist following these steps: https://developer.amazon.com/public/apis/experience/cloud-drive/content/getting-started

I haven't found that Amazon supports other clients than Android an iOS, and I'm little confused now. Do we need to create a phone app and submit to their directory in order to use this library? I don't want to create an app, I just need PHP client to access my cloud storage in order to do some basic management of data.

I'm also not sure if my security profile is whitelisted. It would be great if we could have some docs showing how to set up everything in Amazon's developer console.

Thanks

therealssj commented 8 years ago

@gradosevic No you actually don't need to create an app. Just need to setup the handler, whitelist it and get the client secret and id from there.

Then you can use this library to access the data as you like.

alex-phillips commented 8 years ago

I am out of town this weekend but will add more detailed information on setting up a white listed app when I get back.

alex-phillips commented 8 years ago

If you are only using this library for cli and not integration, I would recommend the node js version of mine as it is more fleshed out and has the ability to utilize my credentials if you don't want to white list your own app

gradosevic commented 8 years ago

@therealssj Thanks for the info, I have created a security profile and have client id, but it does not seem that everything is set correctly. @alex-phillips That would be great, thanks! I will try the node js version in the meantime.

AlbinoDrought commented 8 years ago

For anyone else having issues with whitelisting and ending up on an Amazon page something like the following:

We're sorry! An error occurred when we tried to process your request. Rest assured, we're already working on the problem and expect to resolve it shortly.

Make sure to click the "Show Details" link. In my case, it was not accepting my return URL (localhost), since I only authorized it for the production server. Easy-to-solve headache if I just read more of the page.