Foxx oauth2 configuration - arangodb

To play with the demo-sessions app, I've got the oauth2 app mounted on /oauth2 as required.
In arangodb/Foxx doc, the oauth2 endpoints seems to be defined as strings (i.e https://github.com/arangodb-foxx/util-oauth2 )
But when I perform that with correct urls, and try to play with oauth, I've got an error :
...\oauth2\APP\manifest.json\": attribute child \"authEndpoint\" fails because [\"authEndpoint\" must be an object] (was \"[object Object]\").]","...
Oauth endpoints definitions are expected to be objects, not strings.
So what is the correct configuration for Foxx oauth2 ?
Thanks for help,

I can't reproduce your problem but the OAuth2 app has been updated for ArangoDB 2.7. You can still install odler versions of the OAuth2 app from the "install from GitHub" dialog, though.

I understand my mistake. In the code of the oauth2 2.0 release, the manifest just references the export.js file. In the previous release (1.2), a providers.js file was supplied and referenced in the manifest. Then in this previous release, it was possible to use different providers (what I want) as described in the 1.2 setup.js.
var providers = db._collection(providersName);
I just fetch the files providers.js, and setup.js from 1.2 github tag and configure them for my configuration, and that's ok.

Related

Creating a main account twilio client on a subaccount node function

I'm developing a twilio function on a subaccount that needs to acces a twilio client on the main account. The function is being deployed through a Github action to the subaccount.
For this, on the subaccount function I have:
const mainClient = new twilio(context.MAIN_TWILIO_ACCOUNT_SID, context.MAIN_TWILIO_AUTH_TOKEN);
Then I need to access serverless.services but I'm getting serverless undefined therefore can't access services.
i.e.
return mainClient.serverless.services(...
I tested code locally and it worked but failed on deployment. Is it possible to access services on main account from a subaccount function??
Thanks.
For anyone experiencing a similar issue.
My problem was that deploying without being explicit about dependencies doesnt install the latests version of dependencies.
Deploy through github installed twilio node sdk version 3.29.0 but this version doesn includes serverless api yet. So I explicitly added latest twilio node sdk (3.75.0 at the moment) and that fixed the problem.
Thanks.

How do i use the Kenitco API from a Console App

I'm using Kentico V10 and I can run the website locally. However, when i try to use the API from a console app, i'm getting the following error.
{"Object type 'cms.class' not found."}
The stackTrace has a call to check license. I'm following this page, and it says you have to add a license for your domain, but what domain is used when you are running from a console app?
https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-kentico-api-externally
I'm using this code from taken from this page.
https://docs.kentico.com/k10/managing-users/user-registration-and-authentication/configuring-single-sign-on
CMS.DataEngine.CMSApplication.Init();
string userName = "myuser";
// Gets the user with the specified user name
UserInfo userInfo = UserInfoProvider.GetUserInfo(userName);
// Gets the authentication URL for a specified user and target URL
string url = AuthenticationHelper.GetUserAuthenticationUrl(userInfo, "SecuredSurvey");
If that was available via the REST API, i'd be happy to get the URL that way, but from what i can see, it's not available.
-Randy
Kentico has some good documentation on how to use the API in an external application, specifically a console library here.
Very notable steps are:
Connecting to the database; make sure you use the same connection string as in your web.config
Install the Kentico.Libraries NuGet package
Initialize Kentico in your application in the Global.asax file.
Write custom code all day long.

Error running Vorto Dashboard for Bosch iot suite

I am trying to run Vorto dashboard on Raspberry Pi to visualize my Bosch IoT "things" data.
In order to run the Vorto Dashboard, I installed npm and nodejs and created the config.json file.
I am getting the below error whenever I try to run the dashboard using the command: sudo vorto-dashboard config.json, knowing that I already added the OAuth2 Client credentials.
No credentials given, can not get things
Could not get the token with given credentials. - StatusCodeError: 400 -
{"error":"unauthorized_client","error_description":"INVALID_CREDENTIALS:
Invalid client credentials"}
I am currently contributing the Vorto Project as an Intern at Bosch. Due to changes in the Vorto-Dashboard we combined and merged the functionality of a previous dashboard with another coexisting updated UI, providing advanced ways to visualize the existing devices.
As the uploaded state was work in progress, we temporarily disabled the config.json methodology and removed existing references from the documentation. Apparently, the reference in the tutorial you found was omitted, sorry for that!
Today, I deployed a new version 0.5.0 of the vorto-dashboard which should work as usual. You are now able to work with either process.env.[...] varibales or a config.json file. Thank you Mena for the quick response!
Feel free to let me know if you need any further help or have additional feedback.
TL;DR
To resolve your issue, store your OAUth credentials as environmental variables.
E.g. in debian et al., export BOSCH_CLIENT_ID=... etc., then start the dashboard in the same terminal.
Context
I was about to ask the same question, as I got the same error message no matter how I referenced the config.json file (relative path, absolute path, no reference, etc.).
For clarification, the tutorial pointing to a config.json resource for storing OAuth credentials is here.
Quoting:
While the dependencies are being installed, create the config.json file and insert client_id, secret and scope from your Already created
OAuth2 Client. The content of the file has to look like this:
{
"client_id": "<YOUR_CLIENT_ID>",
"client_secret": "<YOUR_CLIENT_SECRET",
"scope": "<YOUR_SCOPE>",
"intervalMS": 10000
}
The reference to the config.json file has been removed from the README.md resource in the vorto-dashboard module of vorto-examples.
The latest README.md suggests providing the OAuth credentials through environmental variables:
You can provide your OAuth2 credentials through environment variables.
The three environment variables you have to provide are:
BOSCH_CLIENT_ID
BOSCH_CLIENT_SECRET
BOSCH_SCOPE
[...]
Looking at the source, I can only find an explicit reference to a config.json in the start script entry for package_for_deployment.json (nor anything around the source seems to be consuming, say, argv[2] for that matter).
The AuthToken.js resource in charge of handling OAuth credentials only seems to reference environmental variables through the process.env.[...] references.
Elaboration
This is only speculation at the time of writing, but I suspect the reason why the config.json methodology has been abandoned might have something to do with strengthening security, i.e. not storing OAuth credentials permanently in a file.
If that much is true, then the tutorial page should probably be amended with the latest instructions from the README.md.

Swagger UI not working with Swashbuckle latest version

I am using Swashbuckle 5.3 version in my .NET Web API with Basic Authentication (as per this link). Now when I am trying to update with Swashbuckle 5.6 version, it's throwing error 'Key is not found'.
The issue is at following code snippet. During route mapping, it's not able to find 'swagger_ui' from route collections. I tried with other different route values ( like 'swagger' , '/swagger','swagger/docs' ) but none of them is working
var route = config.Routes["swagger_ui"];
config.Routes.Remove("swagger_ui");
config.Routes.MapHttpRoute("swagger_ui", route.RouteTemplate, route.Defaults, route.Constraints, new AuthMessageHandler(route.Handler));
I replaced 'swagger_ui' with 'swagger_ui_shortcut' and it works :) I did change by referring this [link] (https://github.com/domaindrivendev/Swashbuckle/blob/master/Swashbuckle.Core/Application/HttpConfigurationExtensions.cs)
But I will investigate for proper solution

Azure Auth error: Multiple types were found that match the login provider named 'facebook'

I'm running into an error when trying to authenticate a user via Facebook using the Azure Mobile Services built in APIs. I've looked through my packages and can't see any reason why I'd have two providers as suggested in the error:
Multiple types were found that match the login provider named
'facebook'. This can happen if multiple login providers are defined
with the same name but different casing which is not supported. The
request for 'facebook' has found the following matching login
providers: Facebook Facebook.
I did create a branch that upgraded to the App Services and then reverted back to AMS instead. I'm wondering if something is lingering which is causing the problem.
My package list is as follows:
Autofac{3.5.2}
AutoMapper{3.2.1}
EntityFramework{6.1.1}
Microsoft.ApplicationInsights{1.0.0}
Microsoft.ApplicationInsights.Agent.Intercept{0.17.0}
Microsoft.ApplicationInsights.DependencyCollector{1.0.0}
Microsoft.ApplicationInsights.JavaScript{0.11.0-build09387}
Microsoft.ApplicationInsights.PerfCounterCollector{1.0.0}
Microsoft.ApplicationInsights.Web{1.0.0}
Microsoft.ApplicationInsights.Web.TelemetryChannel{1.0.0}
Microsoft.AspNet.Cors{5.2.2}
Microsoft.AspNet.Identity.Core{2.0.1}
Microsoft.AspNet.Identity.Owin{2.0.1}
Microsoft.AspNet.Razor{3.2.2}
Microsoft.AspNet.WebApi.Client{5.2.2}
Microsoft.AspNet.WebApi.Core{5.2.2}
Microsoft.AspNet.WebApi.Cors{5.2.2}
Microsoft.AspNet.WebApi.OData{5.2.2}
Microsoft.AspNet.WebApi.Owin{5.2.2}
Microsoft.AspNet.WebApi.Tracing{5.2.2}
Microsoft.Data.Edm{5.6.2}
Microsoft.Data.OData{5.6.2}
Microsoft.Data.Services.Client{5.6.2}
Microsoft.Owin{3.0.0}
Microsoft.Owin.Host.SystemWeb{3.0.0}
Microsoft.Owin.Security{2.1.0}
Microsoft.Owin.Security.ActiveDirectory{2.1.0}
Microsoft.Owin.Security.Cookies{2.1.0}
Microsoft.Owin.Security.Facebook{2.1.0}
Microsoft.Owin.Security.Google{2.1.0}
Microsoft.Owin.Security.Jwt{2.1.0}
Microsoft.Owin.Security.MicrosoftAccount{2.1.0}
Microsoft.Owin.Security.OAuth{2.1.0}
Microsoft.Owin.Security.Twitter{2.1.0}
Microsoft.WindowsAzure.ConfigurationManager{2.0.3}
Newtonsoft.Json{6.0.4}
Owin{1.0}
RazorEngine{3.4.1}
Sendgrid{6.1.0}
SendGrid.SmtpApi{1.3.1}
System.IdentityModel.Tokens.Jwt{3.0.2}
System.Spatial{5.6.2}
WindowsAzure.MobileServices.Backend{1.0.470}
WindowsAzure.MobileServices.Backend.Entity{1.0.470}
WindowsAzure.MobileServices.Backend.Storage{1.0.470}
WindowsAzure.MobileServices.Backend.Tables{1.0.470}
WindowsAzure.ServiceBus{2.3.4.0}
WindowsAzure.Storage{3.1.0.1}
Is there anything here which could be causing the issue?
Having compared with an older version of the project, it looks to not be related at all to my packages. Instead the problem was caused by adding the login provider within the WebApiConfig class.
Removing the following resolved the issue:
options.LoginProviders.Add(typeof(FacebookLoginProvider));

Resources