Web Api download file using jQuery Ajax but not with fileName - filenames

according to the link
Web Api won't download file using jQuery Ajax and Basic Auth
whitch solution have helped me a lot ,
i wanted to ask question:
why the confirmation to user about opening/saving file doesn't show its name(export_gui) but the controller name(in IE: downloadget; in chrome: "הורד 6" without extension xls)?
thanks

i found the solution: add this row to DownloadController Get method:result.Content.Headers.ContentDisposition.FileName = fileName;

Related

How to call Bitrix24's API using Postman?

I researched on google and I'm stuck while I try to find out Bitrix24 API docs for users using PostMan. Is there an available resource that could help me solve my trouble? , I hope I could retrieve a document or some things like this. Thanks for reading <3
Try this endpoint on your postman
https://example.bitrix24.id/rest/crm.product.list
This is for the CRM Product List
https://training.bitrix24.com/rest_help/crm/products/crm_product_list.php
if this dosent work you can put .json
https://example.bitrix24.id/rest/crm.product.list.json
for the authentication you can go to Developer Resources - Other - Local Application
and put Postman callback on the Handler (https://oauth.pstmn.io/v1/callback).
dont forget to click the Script Only.

how to use joomla 3.8 com_api components for login

I am new to API. I want to know how to use API for Username/Password to my joomla website login page.
Depending upon login and password i want to access the third party portal. I downloaded com_api . I dont know how to use it.
Please help me to solve this issue.
I want to use below id/code to my joomla website.
Headers :
Content-Type : application/json
Authorization : Basic *************************
Body :
{
"refreshToken":"************",
"userName":"*************",
"password":"**********"
}
Thanks a lot...
Regards,
Mahalakshmi
You will need to create a plugin that will implement the event onUserAuthenticate event. In your code, you will check match the username and the password against your 3rd party user database (api) and you will proceed accordingly.
Essentially, the plugin must be an authentication plugin, so take a look at how the plugins\authentication\gmail plugin is written.
No need to use com_api (at least for what you want to do).

How to access OData URLs with authentication

I have a OData Server which returns me a json.
When I accessing the URL through a browser i need to input the username/password.
Doesn't accept the entries which I do in the pop-up. Need to cancel it and then it shows me a dialog box after which i can see the required json.
I am not able to figure out the kind of authentication in use.
Using basic authentication in Postman client is not working.
Any suggestions as to how do I go about using this URL both in postman and inside an Anuglar JS or Node JS program.
You can install interceptor in postman. Go to cookies tab next to body and install the interceptor then turn it on.After installing interceptor you can login with your user/pass and then send your request.
See this picture.enter image description here
Thanks for the input.
But I got access to the code implementation which is accessing the URI which I want.
So There is a Sharepoint/C# application in the universe which is doing a Forms based authentication to get the data required. :/
Will try to reverse engineer that get it working in my Node App.
Cheers. :)

Extern auth services with Web API - can't get the sample to work

I can't get the sample External Authentication Services with Web API(C#) to work with Google. I created a project by following the instructions. However, I noticed that my project created a slightly different code in Startup.ConfigureAuth() method.
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "<valid client id here>",
ClientSecret = "<valid secret here>",
});
The code in the sample does not have the initialization part but without it the code will not even compile.
When I run the app I get the option on the Log In screen to use Google as a service to log in. I'm then taken to Google's site and asked to allow my app to use my info. The app's name appears to be correct so I have to assume that ClientId/ClientSecret provided above are correct. However, when I click "Allow" button I'm taken back to the Log In page instead of the Register page as illustrated in the example.Has anyone managed to make the sample work with Google authentication? If yes, could you please share workarounds, if any.Thanks.
I finally found the source of the problem with a help of a post on this site. Unfortunately I lost the link to the post. Anyway, the solution is to make sure that Google+ APIs are enabled in Google Console for the project - they are not enabled by default. The details can be found here (as suggested by the post).

How to know if a user is logged in from another service

I have a php/apache service and meteor on the same server. I am using the accounts-ui package.
Is there anyway to know in my php script, that a user is logged in, given the login token (session id?)
This is my original need: upload a profile picture for a logged in user.
Very simple right? But I have not found an answer after hours of googling.
First solution would be using html5 File apis to send data to meteor server and the server save the image. But this solution wont even work for IE9.
Second solution is what I am trying: Using a html form to upload picture to a php script (or whatever script, it can be a nodejs script if needed). This script will save the image like a traditional php script does. The thing is I cannot know if the upload request is authorized, otherwise everybody can change profile picture of anybody. I must add some information in the upload request and verify them in the php code before saving the image. I am thinking about sending a request from php script to meteor server but I need to know which parameters to send and how meteor responses it.
How can I achieve the second solution or if someone has a another solution for my origin problem that would be great.
Thank you.
Meteor uses an a protocol called DDP to communicate between the client and server. But as of now there isn't a PHP ddp client so you would have to use a REST type communication method between your meteor server and your PHP server.
If you feel you could build a PHP client for your meteor client, it would greatly help you as you could do stuff like run Meteor.call from your php scripts and have them subscribe to collections. The full DDP spec (pre1) can be found at : https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md
To do a REST method you should use Meteor Router to allow you to create server side routes. It is installed via meteorite which helps you access a list of community packages at [atmosphere.meteor.com].1
sever side js
Meteor.Router.add('/checklogin', 'post', function() {
var userId = this.params.userId;
var loginToken = this.params.loginToken;
if(userId && loginToken) {
return (!!Meteor.findOne({_id:userId,"services.resume.loginTokens.token":loginToken}));
}
});
You can then do a POST request with PHP to /checklogin with two params, one is userId which is the userId (found with Meteor.userId() or localStorage.getItem("Meteor.userId"). The other is the login token found via localStorage.getItem("Meteor.loginToken") on your Meteor client.