Aqueduct template db_and_auth not rendering login form - flutter

I am working on setting up OAuth 2.0 for aqueduct and want to start with a working example. The template db_and_auth is suppose to serve this purpose.
I have followed the readme instructions and connected my database and updated the migration. also I have registered OAuth 2.0 clients in the application database as the readme describes.
The template comes with a route in the channel.dart
router
.route("/auth/form")
.link(() => AuthRedirectController(authServer, delegate: this));
The AuthRedirectController is set up to render a html page (web/login.html) which is part of the template.
However every time I send a get request to this route it returns with a 400 error saying Error
unsupported_response_type in the browser. Additionally in the readme file it only shows testing auth end points using curl. Why would this template include a rendered login page without mention of it in the readme? Any help with this would be much appreciated.

The login form will only be rendered when you pass the correct response_type like so:
http://localhost:8888/auth/form?response_type=token

Related

"Client Error" message when trying to implement an Rest API View

I'm creating an API with Drupal to serve a angular application. The problem is, when I create the view with Rest export and try to access it (via browser or postman), it gaves me an "Client error" message (and nothing more).
I'm using drupal-8.7.6, running with PHP7.3, mysql and apache 2. But I've tried at nginx also and the error appeared again.
To reproduce it, just add some contents, enable the Restful web services, jsonm hal and create a view that exports rest data.
I expect to access the information via GET request (using browser, postman or any other way)
Go to your View
Go to Format
Click on Settings beside Serializer
Finally check Json option and save.
You are done :)
find out what was happening
I was not specificating the format of output, so Drupal was searching for an html to serve. To workaround this, just add to url: ?_format=json, for example, if my view route is "/articles", it will be: http://drupal.dev/articles?_format=json
Go to the rest exports view, click on format setting and click accepted request format to json.

SharePoint Online: Redirect URIs for multi-site environment

We have a multi-site environment where each site has its own redirect URL. We want to use a single Client ID and Secret for our application but register multiple redirect URIs to it. Is it possible to add multiple URLs in below registration form:
I don't think there is possible solution to add on multiple URLs on the SharePoint online app registration form.
But from what i understand there is another way to achieve use a single Client ID and Secret for application and perform multiple redirects.
You can control the redirect url using the appredirect.aspx by specifying the redirect_uri parameter if you need to redirect from the default one check here for reference.
Basiclly it call the subsite page containing the below JS to install the app.
var url = String.format(
"{0}/_layouts/15/appredirect.aspx?client_id={1}&redirect_uri=https://***.azurewebsites.net/<<controller>>/<<view method containing the code to install the app>>?{{StandardTokens}}",
<<subsite url>>, "<<client id>>");
window.location.href = url;
The above javascript calls the appredirect.aspx page which then calls the app site as below,
https://****.azurewebsites.net/home?SPHostUrl=<<subsiteurl>>&SPLanguage=en-US&SPClientTag=1&SPProductNumber=**&SPAppWebUrl=<<weburl>>
Note: The above can be extended to check for the successful installation of the app and display an error message accordingly.
SPWeb.LoadAndInstallWeb equivalent REST / Javascript CSOM is also available here.
Here are some relevant links:
Use the redirect URL in an add-in that asks for permissions on the fly
Redirect URIs and a sample redirect page

FlowRouter Reload Doesn't Route

I'm using FlowRouter. If I start on the homepage everything works well. I can work through the routes (change the pages) without problem. However, if I hit refresh in the browser, I get a series of errors. My url looks like this:
/story/586d536e34821281735b53a4
The ID is being returned in console under the following method:
Tracker.nonreactive(function(){
I think the subscription is being completed, so I'm a little confused as to why reloading a url is different than loading from the home page.
What am I not understanding here?
Reloading a url will make a HTTP request to server to get all the application source. Whereas navigating to a route from another one does not make any HTTP requests to get the application source because they are already available (they were loaded from the previous route), in this case the router will just get the appropriate content and render on the page. This is normal behaviour for Meteor apps and all other single-page apps
The error you encounter is because your data is not yet available on client, to fix it you could simple use a placeholder if the value is undefined.

Hello.js Demo Twitter Error

hellojs twitter error
When i run the twitter demo from demo folder and clicked on twitter button it give me following error
url is undefind in hello.js file on this line if(url.indexOf(x)>-1){
how to fix this error
thanks
When running the demo page in question
http://adodson.com/hello.js/demos/twitter.html
You'll see...
hello.init({
'twitter' : TWITTER_CLIENT_ID
},
{
redirect_uri:'../redirect.html',
oauth_proxy: OAUTH_PROXY_URL
});
The setup includes an OAUTH_PROXY_URL variable. This tells HelloJS the location of the server-side shim in order for this to work with OAuth1 authorisation providers like Twitter (unlike OAuth2 providers which can share authentication tokens purely client-side)
If running this from a local domain like //localhost this will have been an undefined value.
You'll need to do two things to get the demo working.
Define the oauth_proxy option in the demo code. See http://auth-server.herokuapps.com for setting one up. OR remove it entirely and by default it will use the above service - you'll need to register third party apps there (recommended).
Change your development environment in your host file to something other than //localhost, that way you can register OAuth2 providers which are domain sensitive and often wont let you use localhost when registering your apps callback URI. If you change your development environment to be local.knarly.com with hello.js project as a subfolder - then you can skip step 1 as the oauth_proxy will be defined correctly.

Facebook authentication within a Page Tab

According to the specification here: http://developers.facebook.com/docs/authentication/pagetab/ I want to autorize user with the server-side flow on page tab. I use PHP-SDK.
My redirect_uri parameter is build like that:
https://www.facebook.com/pages/null/PAGE_ID/app_YOUR_APP_ID
and I keep getting:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
I was trying many different settings combinations. Now I have filled fields: App Domains,Site URL,Canvas URL,Secure Canvas URL,Page Tab URL,Secure Page Tab URL but still without success. Addresses are ending with / and are all the same.
Link are build proper by the sdk. I test building it "by hand" without encoding of redirect_uri param and redirect link build like that:
https://www.facebook.com/PAGE_USERNAME/app_YOUR_APP_ID
https://www.facebook.com/pages/Page_Title/PAGE_ID?sk=app_YOUR_APP_ID
Can someone tell me what i'm doing wrong?
The answer to that question is that facebook documentation is incorrect. Format of return_uri that worked is:
https://www.facebook.com/pages/null/PAGE_ID?sk=app_YOUR_APP_ID
The format of return_uri changed again, the new format is:
https://www.facebook.com/PAGE_NAME?sk=app_YOUR_APP_ID