Automatically Creating Accounts using Dropbox SDK - php

I have a new social-network like web app coming up, and I want a space where a user can upload a file and see the files he has uploaded.
Of course, I am already a user of dropbox and found out they have numerous sdk's to use. I was hoping I could now integrate dropbox into my web app.
When a user signs up for my application, it should create a new dropbox account for them (without asking), using the email they are also supplied when signing up. It should then let the user access the files on the dropbox website, through the application or using the desktop app.
Is this at all possible?
Web App is in PHP with support of MySQL.

Not right now, and I really doubt it will ever be possible. Imagine a bot just creating thousands of accounts; or someone just using it as their hosting service... (cough ;))

Related

How to set up file uploads to Google Drive in PHP using a Service Account?

I'm trying to set up a page using XAMPP which will take a file uploaded by the user and upload it to a Google Drive I've created. I'm aware that this is likely a newbie issue, but this is my first time trying to use the Drive API
Most tutorials seem to use OAuth when creating the required credentials, however as I understand it this will require the user to log in with their Google account to give the page permission to store the file. (If this isn't the case let me know.) I would prefer if this wasn't the case, so I'd prefer to use a Service Account.
The issue is that the tutorials I've found seem to require a 'credentials.json' file, which I've gathered is provided by the OAuth system.
I've created a Service Account which has the relevant permissions for the Google Drive API. As far as I understand, OAuth shouldn't be required for my webpage as the files which will be stored will not contain any of the user's private information.
If you know how I can get the file uploads set up using the created Service Account it would be a big help.

How to view drive files in my application with an access token of my mail without end user login with their mail

I have a web application which is configured with my mail id. I have functionality of view google drive files in screen. Any user who logged in my site able to view the drive file (located in my mail id).But it is working only if the end user login with Gmail in the same browser. I want my application should work with my mail id that i configured in my system. Every user who logged into my site should able to view the drive file even though they don't have any permission to the drive file. Also I don't want my drive files should be public.so that any one with link cannot view the files. Am using google drive php client v3 for it. I didn't find any code samples regarding this. Any help/clarification is appreciated guys really
I have a web application which is configured with my mail id.
I would be intrested to know how you have achived this, I suspect that you mean you logged in your application using Oauth2 and are running it with the same Oauth2 token.
I have functionality of view google drive files in screen.
I suspect that you mean you can open this file in the Google drive web application. Probably using the weblink from the file.get response.
Any user who logged in my site able to view the drive file (located in my mail id). But it is working only if the end user login with Gmail in the same browser.
Just because your application using the google drive api using your credentials with Oauth2 does not mean that the weblink will open for anyone but you or someone who has been granted access. Anyone who wants to view the file will still have either access to login to your account or have permission on the file from their own google drive account.
I do not recommend you give everyone the login and password to your google account.
I want my application should work with my mail id that i configured in my system.
This is not possible you might be able to get around it using a service account with domain wide delegation to a workspace account but its still only going to give you Google drive api access. It will not give a random person access to a file on your drive account. As the Google drive web application will only show a file that the user has access to.
Every user who logged into my site should able to view the drive file even though they don't have any permission to the drive file.
This may be possible if you set the file to public.
Also I don't want my drive files should be public.
You need to understand the difference between private and public data. Private data is owned by someone, and to get access to that you must have the permission of that person. In order to get permission to access a google drive file if you don't want to set it public you will need to share the file with this person.
so that any one with link cannot view the files.
In that case the file is private and you will need to share it with them.
Am using google drive php client v3 for it. I didn't find any code samples regarding this.
That is because what you want to do is not possible.
comments.
In order to access a file stored on Google drive someone needs to have access to it. Even if you set the file public I suspect the user will still need to be logged into their own google drive account.
Google drive is a file storage system its not meant for file hosting in your application.
Even using a service account will not help you in this case as it sounds like you want to open the file in the google drive web application.

Allow users to download files from Google Drive on my behalf

I would first like to apologize if this question is a duplicate; perhaps I'm not being able to word what I need correctly because I really couldn't find a solution for my need after several hours of research...
I need logged users of my application (PHP, Laravel 5.7) to be able to download files from a specific folder on my Google Drive on my behalf; of course, without having my credentials, but I'm being unable to figure out how to make the request; all the examples I found were to allow users to download their own files after they authenticate with their credentials. Since Google Drive API uses OAUTH2, I thought I could just send a request to some endpoint with Authentication header bearing my token and the "file id" and the download would start but after scavenging the docs I still couldn't find this endpoint.
EDIT: Thanks to Osama Ibrahim for pointing to me the above endpoint.
Sorry for long text, tl;dr:
I need to know how my application can download a file on my drive programatically, requesting a token with my credentials without having to go through the google login UI.

Access Google Drive with PHP (or javascript)

I have a small site/web application where registered users can see some files that I periodically prepare for them; I store these files in separate directories and every user can only see and download their own files.
Now, I'm moving these directories to Google Drive and I would keep functionalities like file listing and downloading.
Reading the official docs I found some interesting examples about file download/upload, but all of them talk about authorization that user must give in order to access to their Drive and this is not what I'm looking for, I don't want access to their Drive!
As I can see, the doc is not contempling the case that someone may want to give (read-only) access to own Drive. But maybe I'm missing something...
Basically, I need the list of files on my Drive account and, if requested, a way to download one (or more). The only one that has the auth to Drive account is my server, users will send request from it.
Is it possible? I think yes, but I can't find any docs about that. How can I authorize my server?
I think you're looking for the Using OAuth 2.0 for Web Server Applications where you'll be using service accounts to achieve your goal.
"This document explains how web server applications use the Google API
Client Library for PHP to implement OAuth 2.0 authorization to access
Google APIs. OAuth 2.0 allows users to share specific data with an
application while keeping their usernames, passwords, and other
information private. For example, an application can use OAuth 2.0 to
obtain permission from users to store files in their Google Drives."
The snippets are in PHP too, so it works in your favor.

How to authenticate user by php to use it's drive

At the moment I am trying to find out how to use my Google Drive to store images.
I don't want any user interaction. Users access my web-application then upload files and these files should be stored in my Google drive.
I figured out service account. It works fine, no user interaction. The only problem is storage limit and it is not possible to buy extra to extend it. So we can not use it.
Web application type where I provide redirect URI, sends me code to authenticate to use Drive API. BUT to receive code user should be authenticated and after that I receive code which will allow me to use users Google drive. But here I want to receive code by my account and store images in my Drive.
How can I get rid off user authentication, but use php authentication with my credentials (myaccount#gmail.com) and store files in my drive.
Thanks!

Categories