BOX API trying to connect user and grant access to Box - box-api

I'm trying to get access to my box app via API, i wrote the following API line in "postman":
https://www.box.com/api/oauth2/authorize?response_type=code&client_id=MY_CLIEN_ID&redirect_uri=https://127.0.0.1
AND THEN I get BOX login window i fill the fields and click on the Authorize button
next i get the following box window : "With access to your Box account, "SharingFileSystem"(my app's name) can:
Read and write all files and folders" with button "Grant access to box"
when I'm clicking on this button (Grant access to box) i get "The server refused the connection."
What i need to do for connect to the BOX by API successfully?

Box is trying to redirect you back to a webserver listening on localhost, as you've specified in the request. This is the Handling the Response from Box part of the OAuth2 workflow. You have two options here:
For a web-based application, run a webserver on localhost that can handle the HTTP redirect from Box, or
For a client application, register a custom scheme for your application in your OS. This can be any arbitrary name, e.g. foo. Use that custom scheme in the redirect_uri field of your original request to Box: redirect_uri=foo://bar. Your OS will then send the redirect parameters to your application.

You can now use the Postman packaged app version to get access tokens for OAuth 2. Helps you avoid the hassle of setting up a server.

Related

Allow HTTP web application to open custom protocol without being prompted always

I have a web application that opens a local application on client machines using a protocol already registered during client setup.
The web application gives an alert when opening local application and gives a checkbox to be selected in that alert. If checkbox is checked, the browser doesn't prompt next time when opening the local application.
However, this checkbox is seen when my web application is hosted with https. When hosted with http, the checkbox is not given by the browser and the browser always throws the alert. Can the user at client side manually do something to avoid the alert every time?
I looked into the Google chrome settings. There is Protocol Handlers in Site Settings but it doesn't allow to enter a site manually. It shows outlook.office.com which I can remove but doesn't give a way to enter a site manually.
Is there a workaround to trust a site and not show alert for this specific trusted site
If your environment is Microsoft, with a GPO the website can be added in the safe list address of Internet Explorer options. Otherwise, you will have to do it manually in each endpoint.

Jmeter sharepoint login issues

i'm using Jmeter to perform some tests on a website with the login in sharepoint.
The problem i'm facing is about the login: it has to be performed by the chrome mask (photo attached).
If i do it manually, obviously no problem.
If i try it by jmeter i obtain always error401.
In order to perform it, i've tried by using the jmeter recorder, but it doesn't perform the login because of the proxy.
So i've tried with the chrome plugin and it has correctly recorded everithing, giving me a get request only and adding to my plan an HTTP Authorization Manager with:
BASEURL: my_link
USERNAME: MyDomain\MyUsername
PASSWORD: MyPassword
DOMAIN is empty
REALM is empty
MECHANISM: basic
So, trying to launch the only get that i have, with the following header manager:
it always gives me error 401:
I've also tried by moving the domain from the username tab to Domain and removed the date header from the header manager of the get.
I've also seen that the recording from blazemeter plugin gives to me a get with an header manager with the field "authorization" compiled with "Basic and the key calculated starting from username and password" and is a Basic type.
But if i remove that authentication header and launch again, the requestheaders doesn't contain anymore a basic authorization (with the relative code) but a NTLM request with a bigger code.
What i'm doing wrong? How can i perform correctly the login?
I believe you need to change "Mechanism" to BASIC_DIGEST for NTLM authentication (if you're sure that it's really NTLM)
However it is better to inspect request and response headers, it will allow you to identify which authentication protocol is being used under the hood.
For NTLM you need to supply: username (without domain), password, domain and mechanism (BASIC_DIGEST)
If it is Kerberos - you need to choose KERBEROS mechanism, specify the realm and perform the appropriate configuration in jaas.conf and krb5.conf files (both live in "bin" folder of your JMeter installation
More information: Windows Authentication with Apache JMeter

Connect to MySQl In App Database In Azure Webjob

I have a MySQL In-App Database in azure, I can connect fine in PHP on a normal webpage, my issue is I am trying to create a webjob, but when ever I try the web job file can't connect to the database and the connection string is empty.
I have tried to connect using the following:
getenv('MYSQLCONNSTR_bridgesConnection');
$_SERVER['MYSQLCONNSTR_localdb'];
Nither of these are bring back a connection string that I am able to use.
I have the code to break down the strings ect, it just that I can't get the database connection string, or find anywhere on how to get it into the webjob.
After my test, the current feasible way is to send http request in webjob to get the connection string you want.
Test step:
Create a new application appsetting,mytest, and create a new webjob to read it.
Find webjob logs.
Because both Application settings and Connection strings are derived from App Config, I think they cannot be read by ConfigurationManager.AppSettings, so the rest api method is used to get the parameters.
Then I create a Connection strings,
Get connection strings by rest api.
You can try it by yourself.
Connect to MySQL:
In Azure App services access the specific App Services you created
Then click on MySQL In App
In the MySQL In App pane, click on Manage to access phpAdmin
It’ll pop open a new window with the phpMyAdmin tool. Notice at the top of the window it’ll display the IP and port number your database is running on
Get your port number from the phpMyAdmin tool,
Access MySQL username and password:
To get your username and password. This information is in the MYSQLCONNSTR_localdb.ini file in d:\home\data\mysql as displayed in the MySQL In App pane earlier.
To get this file, the best way is to go to Advanced Tools on the blade for your App Service.
You will find Advanced Tools under Development Tools
Under Development Tools, Click on Advanced Tools
In the Advanced Tools pane, click on Go in the Pane.
This will open Kudu Services in a new tab
In Kudu Services, click on Debug console at the top and choose CMD.
This will take you to the path and you’re GUI file list will load above with the console window below.
Clicking on data folder in the GUI file list, will display aspnet and mysql folder.
Click on mysql to access location for MYSQLCONNSTR_localdb.ini
Here you can download the file, open it with Notepad and get your username and password from the connection string stored inside.
You can also click on Edit in the GUI to view your password and username details, the content on edit looks like this
Database=databasename;Data Source=127.0.0.1;User Id=username;Password=password

How to use Google Calendar's watch method inside a Chrome Extension without a server

In my Chrome extension is it possible to use Google Calendar's API watch method to receive push notifications instead of pollling without hosting my own server?
Can Firebase/FCM or chrome.gcm provide a solution? cloud based perhaps?
You can avoid the long polling but you'd still have to host a server even for the FCM.
I'd suggest you;
Go with Heroku, set up a free NodeJS dyno for your server. You can use the free MongoDB addon as your DB. Use the guide here to setup the server.
Setup FCM client in your extension using the guide here. Request the notification permission and get token on install or if you have a login system in your extension, after user has authorized. Send the token to your server and save in DB against that user's id or any other unique id that you can track from Calendar notification.
Use the Heroku app URL as target in Watch API. So all the notifications will be delivered to your Heroku instance.
When a notification is received from Calendar API;
Use any form of id in that notification and find the user's device/FCM token from DB.
Use that token as to and send message to that device. Handle the message on device as you want.
Calendar API -> Heroku Server -> FCM Server -> User Device
Means no need for 'long polling'. Your notifications will be delivered in realtime. Depending on the usage, you could also keep the Heroku instance free.

Reporting services always requires credentials

I'm building SSRS reports with the goal of downloading them as XML through URL. That is,
example.com/ReportServer/Pages/ReportViewer.aspx?%2fReports%2fReportName&parameterInput=parameterValue&rs:Format=XML
For the purposes of building tools and not having to authenticate for the time being, we'd like to disable credentials checking. However, no matter the settings specified, I'm prompted for credentials in a popup dialog.
To test that my "connect using" settings weren't being overlooked, in the reports manager I selected "Connect using credentials supplied by the user running the report". When this is selected, I'm still prompted once for credentials in a dialog, then a second time as expected.
I've tried adding an unattended execution account, not requiring credentials, and supplying credentials stored in the report. None of these have worked and I'm wondering whether there's a setting I've missed in the rsreportserver.config, or something beyond my control?
You can create a shared Data Source in your reporting services (which will hold database connection credentials) and use it in your report. After that you don't need to pass Data Source credentials via URL when you are generating a report.