I want to implement a simple way for a user to upload a save file (a really simple json file with no personal information) to their cloud account.
The main problem is that dropbox, google drive etc... don't work with simple username and password, they need OAuth 2, and a browser for log in. But it's not easy to implement that in a Unity game, and it require that I set up a secret API key connected to my account (with limited put and get possible without pay).
I want to be able to use the final user account to upload 1 single json file to the user account, and be able to download it from another device (that's the only reason why I want to be able to log in... without log in I can use something like htput, jsonblob or myjson... but if I want the user to be able to get their save in another device I would need that they copy a really long and not easy keyurl generated by those services).
I saw that with MegaApiClient it should be possible. I imported it into Unity as a native Plugin and I was able to use it in my code.
Problem is that I cannot Login because I get an error:
TlsException: Invalid certificate received from server
the code I use it the one in the example:
var client = new MegaApiClient();
client.Login("username#domain.com", "passw0rd");
There is a way to make it work? If not do you have any idea how to solve my problem?
In the end I decided to go with Dropbox. It's easier than I expected, but you will need to use the code flow with copy/paste (you cannot use the redirect_uri, at least I don't know how to redirect to the app on all platforms).
I don't know how to solve the mega problem.
EDIT. With Unity 2018.2 now MegaApi works.
EDIT. You can use the redirect_uri too, just redirect to 127.0.0.1 on android and localhost on pc.
Related
I am searching for a way to obtain the current code in my Google Authenticator app. for a specific account.
Please note that I'm not looking for embedding Google 2FA to any of server-side application - I guess it has been already well-documented.
I am trying to get the same current code shown in my own Google 2FA app. (by providing my Google credientials ofcourse) so I can make my app fully automated even when logging in (to a specific system/website) without asking for the code each time I start the app.
Thanks by now.
UPDATE:
Even if I can't find any answer or simply "there is no way", there is still a way even if it's too ugly.
Running an ios/android simulator (and configure it once by installing the Google Auth app) and simulate the mouse clicks over it and then capturing a screenshot and decoding the code from the image would be much of a work but also can actually work. I'm just trying to find a better way, if there is any.
You could solve this by generating the OTP code locally using a library such as OTP.Net. Simply save the secret locally, and add it to .gitignore if using git.
Then you can make a code on demand like so:
using OtpNet;
var totp = new Totp(secretKey);
var totpCode = totp.ComputeTotp();
Using Xamarin Ios. in Apps theres usually a pop up on launch that says "(app name) Would like to access your location" or photos, or things along these lines. i couldnt find any information on how to implement this, or even what this confirmation/permission process is called. can someone point me in the right direction? it would be much appreciated
When your application needs to invoke some function that involves user privacy,suah as Camera,Contacts andLocation Services. You will be prompted for authorization by the system.
You should add items in Info.plist As shown in the following image.For example if you want to use Location Services. Otherwise it will be rejected when you want to upload your application to APP Store.
There also some other privacies.Here is a document link for you to referring to:Apple Document
I'm working on a continuing API project. The current issue at hand is to be able to download my data from the AtTask server in precisely the folder structure they exist in on the AtTask servers. I've got the folder creation working nicely; the data types between Document, Document Folder and Document Version seem to be pretty clear. I am a little disillusioned about the fact that extension isn't in the document object (that I have to refer to the document VERSION for that)... but I can see some of the reason for that from a design perspective.
The issue I'm running into now is that I need to get the file content. I originally through from the API documentation that I'd be able to get to the file contents the same way as the documentation recommends uploading it -- through the handle. Unfortunately, neither document nor docv seem to support me accessing the handle except to write a new file.
So that leaves me the "download URL" as the remaining option. If I build the UI strings from the API calls using my browser, I get a URL with https://attaskURL/document/download?ID=xxxx (and can also get the versionID and such). If I paste the url into the browser where I'm logged in to the user interface of AtTask, it works fine and I can download the file. If, instead, I use my C# code to do so, I get the login page returned as a stream for me to download instead of my actual file because I'm not authenicated. I've tried creating a network credential and attaching it to the request with the username and password, but to no avail.
I imagine there's a couple ways to solve this problem -- the easy one being finding a way to "log in" to the download site through code (which doesn't seem to be the usual network credential object in C#) OR find a way to access the file contents through the API.
Appreciate your thoughts!
It looks like you can use the download URL if you put a session id in the URL. The details on getting a session id are here (basically just call login and a session id is returned in JSON):
http://developers.attask.com/api-docs/#Authentication
Then cram it on the end of your document download URL:
https://yourcompany.attask-ondemand.com/document/download?ID=xxxx&sessionID=abc1234
I've given this a quick test and I'm able to access a document.
You can use the downloadURL and a sessionID IF you are not using SAML authentication.
I have tried it both ways and using SAML will redirect you to the login page.
what is the recommended approach for polling password changes only in Active Directory, get the updated password and update else where ?
I have looked into classes in System.DirectoryServices.Protocols namespace like 'DirectoryNotificationControl' class but seems like this would poll for any attribute and later on we need to query to see if attribute we are interested (password) has indeed changed.
Also how do we get password value from active directory ? It is possible using LSA although very complex..
The only "simple" way (and those are VERY big quotes around "simple") is to write up a Password Filter Dll that is hosted on the Domain Controller.
You can implement the PasswordChangeNotify interface and have your code update whatever external thing that needed to be notified of the password change.
However this must be done in native code, so no C# allowed.
I originally went down this road and ended up giving up on it and used a different method of tracking the changed passwords, however one thing I did discover along the way was an open source project called passwdhk that may be helpful for you.
What passwdhk does is it implements a Password Filter DLL for you, however all the filter does is launch another executable with the command line arguments that where passed in to the password change notify function ("post-change program" is forwarding the arguments from PasswordChangeNotify, "pre-change program" is forwarding the arguments from PasswordFilter). This allows you to still write your code that updates the other service in C#, it just takes the password in from the command line instead of intercepting the password itself.
As far as I know, by default the password (stored in an encrypted way) cant't be read in Active-Directory. You can change the policy to store it in a reversible way, but it's really not a good thing.
The only way I know, is to install a componant on each client machine. The component catch the password change and you can do what you want.
From NT to XP this component was called GINA (DLL). Begining Vista this companent should be written using Credential Provider API.
I need a little help with the C# example program of Google-Drive...
I used this so-called "tutorial"/"example":
https://developers.google.com/drive/examples/dotnet
And the code from here:
https://code.google.com/p/google-drive-sdk-samples/source/checkout
I uploaded my (only slightly modified) sourcecode here in case anybody doesn't have Mercurial (I didn't have Mercurial and no admin rights to install it either, and Mercurial is the only way to get the sourcecode...):
http://verzend.be/elt0k13enraw/DrEdit.rar.html
I always get
"Ressource cannot be found"
Requested URL: /oauth2callback
I don't find this astonishing, as no oauth2callback controller or handler is implemented...
I tried adding a Controller called oauth2callbackController and redirecting to another action in oauth2callbackController.Index, doing
return new RedirectResult("/about/about");
But that only creates a NULL-reference exception.
So i figured, maybe the wrong controller and redirected to
return new RedirectResult("/drive/Index");
But that only creates an infinite loop of redirect -> allow -> redirect - allow -> etc.
BTW, the config to change the API key + REDIRECT_URI is in
Models\ClientCredentials.cs
Note:
The problem aren't my modifications.
The sample also didn't work unmodified, with the exact same error.
All I did was removing EntityFramwork references, and throwing "Not implemented exception" when a method using entity was called.
Edit:
Additional information:
What I really wanted to do in the first place is to write a console service that exports my database, LZMA-compresses the exported content, encrypts that with OpenPGP, and uploads the database of my server to Google drive every day at 24:00 o'clock, without any user input.
I got export working without a problem, i got the LZMA compression working without a problem, I got the encryption with PGP working without a problem.
After the end of the working day (grrrr), when I was at home, I was even able to download the example-code with the mercurial installed on my Linux-machine at home, and bring it on the windows machine using SMB...
But now I can't get the sample for the Google-drive SDK working...
And moreover, what I really need is an example for a console service/daemon, not a web-application.
When I created the API key, I saw one could create a key for a service, but there is no example on how to write a Google-Drive service (console application), and no useful documentation as well (yea there is a reference, but it's only a reference, IntelliSense provides about the same)...
When configuring your app in the API Access tab of the APIs Console, you had to set the root (/) of your web server as the redirect URI and not /oauth2callback.
Assuming that your app is published at www.example.com, just go back to the APIs Console and set it to www.example.com instead of www.example.com/oauth2callback