I have been through several of the amazon docs on this but I still can/t find a simple solution. I want to create a simple web page that allows users to upload images to my s3 bucket. Whenever I use an example I always get missing credentials as a response.
I also want to integrate a simple log on using the mobile phone with amazon's cognito. It is a single page application with no server back end. Happy to use Angular1 in the page.
I have the aws account set up but I am stuggling to find a simple example of how to do this. Does anyone have an example of how I might do this or where a tutorial that explains this very simply might be?
Related
First off sorry if this question is a 'bad' one; I am very new to the world of web apps, API's and Javascript.
As the title says I am trying to get a user's steamID using the Steam API using javascript.
This is for a web app that needs to get information about the games a user plays. (Which from my understanding is only obtainable using this special ID.)
My initial thoughts on how to do this would be to use openID so that the user gives Steam their info and the ID is returned to my app.
I have seen that there are lots of examples of this using php; however, because of project requirements, everything must be run in the browser. There is no backend server to even run php on so it is not an option what so ever.
I have spent a better part of a day trying to figure this out and have made no real progress, everything seems to lead back to using php. (maybe what I need under my requirements is not possible?) So an example or anything really would be much appreciated.
welcome to Stack Overflow I can see you are confused as to where to start or progress so here is a basic roadmap:
You will need to contact Steam to get an API key first.
Next part is more tricky for a beginner. You will need to get node.js which is a package manager. Effectively it's a large library of javascript programs which you can import into your own program to do things with. One of these so called "packages" is openid-client, which is an implementation of openID that you can add to your site. Users click on the openID button on your site, it redirects them to steam servers, they login, then your site gets their info without leaking their username or password to you.
Now that you have both the steamID and your API Key your program can input these two into the url steam provides to get owned games. You can input this completed url into fetch or axios (another node package that can request data from servers) and it will respond with the user's owned games in json format.
Here are a list of resources in order to get you started:
https://steamcommunity.com/dev
https://nodejs.org/en/
https://www.npmjs.com/package/openid-client
https://www.npmjs.com/package/node-fetch OR https://www.npmjs.com/package/axios
https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29
I suggest reading the documentation in each of these links and seeing if there is any youtube tutorials that try and do what you are doing with these technologies to help you implement them as a newbie. Overall there is a lot to learn on each of these technologies but as long as you orient yourself using guides or tutorials you will succeed. Good luck.
Check out this page: How to retrieve Steam username using SteamWorks API?.
However, it seems like an issue you might be having is connecting to the actual API. What exactly are you using for testing?
I know from experience, for example, that you can connect using Postman to various API's, and format a request for them in a chosen language, including JS>
Ok so I'm very well aware that S3 is not a fileserver. That said, it's a great tool to manage static websites and many of my websites are 99% static for this project. I'm an AWS Solutions Architect and I still can't think of the easiest and most efficient way to process simple forms on an HTML page in S3.
Yes the obvious answer is spin up an EC2 instance with a PHP processing script, then I'll have to create an RDS instance, etc. which is a ton of work for simply pulling an email address from a site visitor. LAMBDA doesn't support PHP for some ungodly reason or else I'd write and run a function that way.
I've tried a dozen different ways to find a solution that scales but to no avail. Any advice would be greatly appreciated.
You can use API Gateway + Lambda for that.
After user enter static website (S3), provide some data in form and submit it - JavaScript can make request to API Gateway which will trigger Lambda.
For example - user can provide email address and Lambda can save that email in file on another S3 bucket or DynamoDB - depends on what you exacly want to do with that provided emails.
I'm using MEANJS to do a node app.
Basically I have JSON stored in Mongo that I am using json-csv(NPM module) to get out to csv. I was able to get it to download (via a button) locally by doing a couple of tricks. But, when I uploaded it to azure it pooped on me. I rolled back everything and now I don't have the code to post here... but, it didn't really work anyway since I need it to run in azure.
If anyone had some guidance or pointers I would really appreciate it.
You can store your csv in azure blob and provide users link to the blob.
BTW, you may still need authentication so a proper solution is providing users a link belonging to your sites and when users click the link, validate auth then redirect to azure blob links.
I am trying to set up a simple set up as follows:
Have a mobile app with a page consisting of 4 lines (4 html paragraph lines (I am using phonegap)).
I want to use a web page from which I will input the data for those 4 lines. This information is sent to a server and that server transfers this information to that app on that mobile phone. Now, those 4 lines on the mobile phone is filled with the new information.
Similarly user inputs information on another page consisting of 10 lines of li (list). This information is again sent to the server and to the web page where the information is displayed.
I can almost feel the "internet police guys" getting all hyped and ready to vote this question down. But please understand that I have been on this site and various forums desperate to find a tutorial to guide me to do this and not able to find.
I am trying to use ajax to perform this setup. Confused how I would be using the php file. Information such as password n username is going to go in that php file to connect to the server. But php is a server side script thus needs to sit at the public_html folder. How do I use the php file from my desktop? Write a separate javascript to access it?
It is the concept that is confusing me. I am familiar with html,js,php.
I would appreciate any guidance or maybe a link to a tutorial which would help me to do the concept I mentioned. Thanks for listening.
You will need to create an API using PHP. This API is uploaded to your server and is considered "RESTful". Google a tutorial for what fits your needs. You can set all sorts of rules in this API such as requiring any requests to have an ID or access token.
Since you are using PhoneGap, your HTML and JS files rest on the device, so you will need to allow permissions to your API from anywhere. For this you will have to speak to your host provider about unless you know how to configure it yourself (some providers restrict what you want to do by default as an extra security precaution against XSS attacks).
Next, you can either use jQuery, or you can write some AJAX calls by writing the JavaScript yourself.
The most efficient way for this to work is to send JSON objects to and from the API. You will include a "command" in the JSON when you are sending from your app. On the PHP side, you will retrieve this command and use the rest of the data included in your JSON object to process the request. Your API will need to encode a JSON object for return (such as a user's profile information).
Here is a basic PHP API tutorial to get you going that explains some of the features of a RESTful API: PHP API
Here is a simple AJAX function (you will probably want to make this much more modular): AJAX
As broad as your question is, it seems like the best/easiest thing for you to do will be for you to first create a PHP webpage that will access a SQL database to perform the record updating. Actually, this should serve all of your needs for your mobile users assuming you don't need push notifications for live data updates.
I am assuming, since you are using phone gap, that you are more comfortable with web languages. After you get the webpage fully operational, then you should start building your app based on that exact same SQL database. With mobile app development there are a lot more "what if's" (what if the phone rings, what if the app is running in the background, what if there is no cellular service, etc...)
It is always easier to start with what you know and build on that, rather than starting with a new development platform and troubleshooting as problems arise.
I am trying to allow users to upload large files without tying up my servers for an extended amount of time. I thought using dropbox as file storage might be a good solution. My plan is to use javascript to have the client-side connect directly to dropbox, so that my server is not affected.
I have been trying to find a current javascript dropbox api, but have not had much success. I tried using dropbox-js, but it seems that it is using an outdated version of the API as I get the following error with my current test: {"error": "You're using an older version of the Dropbox API with a new API key. Please use the latest version."}
Does anyone know a fairly simple way to accomplish this task?
Set up your application as a Folder app. If things go wrong, at least you won't blow up people's Dropboxes.
Follow these directions for obfuscating your API key and secret.
Use writeFile to upload the files, and then use makeUrl with the downloadHack: true option, then send the URL to your server.
You'll need the git version of dropbox-js to use downloadHack until the 0.7.0 release comes out.