w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Authorizing my Google API app by going through the OAuth2 flow only once
The typical OAuth 2.0 flow goes as follows: Send a request for permission to access the user's data within a certain scope (https://www.googleapis.com/auth/tasks) User gets the authentication screen where they must log in and allow your app to "Manage your tasks" Your app receives an authorization code Your app must exchange the authorization code for an access token and a refresh token. The access token can be used to make authenticated requests to the users data, but it will expire after a set amount of time. The refresh token never expires (unless the user revokes your app's privileges in their account settings) and can be used to get a new request token. You can see the whole flow here in the OAuth2.0 Playground. If you follow the flow correctly and save the two tokens (in a da

Categories : Java

What's the scope for Gmail's OAuth2 IMAP access?
From https://developers.google.com/gmail/xoauth2_protocol: The scope for IMAP and SMTP access is https://mail.google.com/

Categories : Python

Automatic login with oauth2
if they are true instagram users, you shouldn't do that. You run the risk that Instagram will revoke your app. That's the whole point of Oauth: users don't have and should never have to share their credentials with 3rd party applications. Now if these users are more like "virtual" users and you are nearly in a 2-legged scenario (i.e. you own the credentials of these users), nothing prevents you to orchestrate the login yourself, instead of displaying a UIWebView and have the user login.

Categories : IOS

How to specify OAuth2 scope with spring-social-security SocialAuthenticationFilter?
You can pass additional scope parameter in a connection / signup form. See example for twitter from the official documentation: <form action="<c:url value="/connect/twitter" />" method="POST"> <input type="hidden" name="scope" value="publish_stream,offline_access" /> ... <button type="submit"><img src="<c:url value="/resources/social/twitter/signin.png" />"/></button> </form> It is the same principle for facebook too, just use appropriate scope values. Be sure that you do not missed this part: Facebook access tokens expire after about 2 hours. So, to avoid having to ask your users to re-authorize ever 2 hours, the best way to keep a long-lived access token is to request "offline_access".

Categories : Java

OAuth2 Login for Google Calendar API
Not sure it is possible, Important note concerning your design: if you login automatically to the club's account, it means that everyone that uses this website is logged in to Google Calendar on behalf of the club's user name. hence, everyone can CHANGE the calendar, delete events, etc. Are you sure you want this to happen? (you can set the login params to "read-only", but even then, it means that the club shows ALL his calendar to everyone. there is no privacy...) I suggest that every user logins with his own creds, and the club's calendar can invite all registered users to his events....

Categories : Api

Facebook Login Flow for Web without Javascript SDK and Logout
That should be easy, looking at the PHP SDK’s method getLogoutUrl, that creates an URL of the following scheme: https://www.facebook.com/logout.php?next=FOO&access_token=USER_ACCESS_TOKEN For FOO you just place the URL of your website where you want the user to be redirected to after they are successfully logged out of Facebook (don’t forget to properly URL-encode that value), and USER_ACCESS_TOKEN should be self-explanatory. (You need an active user access token to log the user out of Facebook – obviously, because otherwise every site on the web could just redirect me to this address and log me out of Facebook, without me actually wanting that to happen.)

Categories : Facebook

granting minimal permissions during facebook "Login Flow for Web"
For reference, since I spent a good amount of time researching an answer to that question, I believe that it is impossible to explicitely not request permission from the user to see his list of friends. The Facebook documentation hints at this by stating that these are the "default" permissions that every application gets.

Categories : Facebook

Is the scope of an oauth2 access token bound to the token or the user?
It sounds like your implementation is not quite complete. The client app is requesting a resource on behalf of the resource owner. When the resource server receives a request with an access token, it should check that (1) the token is valid and not expired, (2) the requested resource is within the scope the token was granted for and (3) the resource owner can access the requested resource. For #1, the authorization server will need to keep track of all tokens and when they expire. For #2, the authorization server will have to remember the scope for each token and be able to relate a particular resource to a scope. The resource server should know how to check #3. To answer your question "Is the scope of an oauth2 access token bound to the token or the user?", the scope is associated wi

Categories : Dotnet

angularjs: directive creates two child scope(not isolation scope)? and how to get scope of an element?[Solved by clear answer]
it's hard to figure out without any jsfiddle for the context. What is your link function? and what is your controller function? By the way, it is the normal behaviour as documentation says transclude:true creates also a new scope. Look at here : https://github.com/angular/angular.js/wiki/Understanding-Scopes The transcluded and the isolated scope (if any) are siblings -- the $parent property of each scope references the same parent scope. When a transcluded and an isolate scope both exist, isolate scope property $$nextSibling will reference the transcluded scope. So if you want to access the 2 siblings from one another, you have to use a 2-way binding with their parent

Categories : Angularjs

What algorithm should I use to find the minimum flow on a digraph where there are lower bounds but not upper bounds on flow?
Add all the "lower bounds" of the flows on each edge: any feasible solution will need that anyway. For each node n in the topological order (i.e. following the edges) from the sink t, if the sum S- of what goes in the edge is greater that the sum S+ of what goes out, then add the flow S+ - S- on all edges of the shortest path between s and t (construct the list of shortest path while doing this for efficiency). Then, you have a 'minimal' assigment (in the sense that it is needed in every feasible solution) such as S+ - S- is nonnegative at each node and the minimal capacity is satisfied on each edge. The problem then reduce to a multiflow problem on the same graph structure: the source is the same; there are no capacity limit; every node where S+ - S- is strictly positive becomes a si

Categories : C++

How do I connect between parent $scope, directive $scope and a modal $scope?
Like I said in the comment you can access the variables from the parent scope in the modal popups scope. HTML <div ng-app="app" id="app"> <div ng-controller="MainCtrl"> <label-select color="{{color}}"></label-select> <div class="flyout"> <ul> <li ng-click="setColor(color)" ng-repeat="color in colors">{{color}}</li> </ul> </div> </div> </div> JS var app = angular.module('app', []); app.controller('MainCtrl', function ($scope) { $scope.color = "#AAADDD"; $scope.colors = ["#AAA", "#BBB", "#CCC", "#DDD", "#EEE"]; $scope.setColor = function (color) { angular.element(".flyout").removeClass("show"); $scope.color = color;

Categories : Javascript

Magento to one step checkout as a separate checkout flow and keep the default flow as it is
Look at config.xml in onestepcheckout extension, you'll see next event: <controller_action_predispatch_checkout_onepage_index> <observers> <magenthemes_onestepcheckout_observer> <type>singleton</type> <class>onestepcheckout/observer</class> <method>initController</method> </magenthemes_onestepcheckout_observer> </observers> </controller_action_predispatch_checkout_onepage_index> So, you need to change function initController() in app/code/local/Magenthemes/Onestepcheckout/Model/Observer.php . Here is it: public function initController($observer) { if (Mage::helper('onestepcheckout')->isActive()) { $observer->getControllerAction()->_redirect('onestepcheckout');

Categories : PHP

Min-cost-flow to max-flow
Sorry I think I misunderstand the question the first time. Yes, Minimum Cost is a special case for max flow. Rather than max flow, min cost assumes that after going through each edge, there is a cost to the flow. Therefore, if you set the cost at each edge to be zero, then min cost is reduced to the max flow. Edit: Since min cost problem needs a pre-defined required flow to send to begin with. You will need to run the above algorithm (with cost of edge c(u, v) = 0) for multiple times to search for the maximum value. For a given range of values, binary search can be used to more efficiently locate the max Do you mean Min Cut Max Flow? (Edit: I do not think you meant this, but this is the basis of proving max flow, worth looking at if you have not) I will be easier to understand if you

Categories : Algorithm

Why ng-transclude's scope is not a child of its directive's scope - if the directive has an isolated scope?
Why ng-transclude's scope is not a child of its directive's scope if the directive has an isolated scope? ng-transclude designed to allow directives to work with arbitrary content, and isolated scopes are designed to allow directives to encapsulate their data. If ng-transclude didn't preserve scopes like that, any arbitrary content that you're transcluding would need to know the implementation details of your directive (i.e. it would need to know what's available on the isolated scope you created). If it's not a bug, how can a container directive pass data to it's content, if not by setting attributes like I tried. If the container directive and contained directives are coupled - i.e. you wrote both of them and need them to act together - then they should communicate via a shar

Categories : Angularjs

making my site show mysite.com/login/ instead of mysite/login.php?action=login&var=1234
Put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / # specific rule to handle these URLs RewriteRule ^login/?$ /login.php [L,NC] RewriteRule ^index/?$ /index.php [L,NC] # OR a generic once to forward all /foo to /foo.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^(.+?)/?$ /$1.php [L]

Categories : Apache

AngularJS $scope.$watch properties of $scope.foo but send old values to server before change
The second parameter of $scope.$watch is a function which receives two parameters : the first one is the new value, the second one the old value. You can simply watch for the whole foo object, and set the third parameter of $scope.$watch to true in order to compare object for equality rather than for reference. Notice that this can be a pretty bad idea if your object is really large : $scope.$watch( 'foo', function (newFoo, oldFoo) { // send old $scope.foo to server with the // previous $scope.foo.bar and $scope.foo.baz }, true ); You can also watch separately foo.bar and foo.baz : var sendAndReplace = function (parameterName, oldParameter) { oldFoo = angular.copy($scope.foo); oldFoo[parameterName] = oldParameter; // send old oldFoo to s

Categories : Angularjs

Angularjs custom directive child scope access parent scope method?
The problem is that the slide directive from angular-ui-bootstrap has created an isolated scope, scope.$parent in the link function isn't the scope of carousel, therefore you can't access play and pause functions. In link function, you can get the carousel's scope by calling scope() on carousel element: var carouselScope = element.parent().parent().scope(); Then, use carouselScope to replace where you have put scope.$parent. http://plnkr.co/edit/1HCiqvTm1Fd9Rh0o8Mtw

Categories : Angularjs

What dependency scope for Derby JDBC drivers in intergration scope (cayenne)
To ensure that the Derby driver is available during plugin execution (vs during your code compilation), you need to add it as a dependency of the plugin itself: <plugin> <groupId>org.apache.cayenne.plugins</groupId> <artifactId>maven-cayenne-plugin</artifactId> <version>3.2M1</version> <dependencies> <dependency> <groupId>org.apache.derby</groupId> <artifactId>derbyclient</artifactId> <version>10.10.1.1</version> </dependency> </dependencies> .... </plugin>

Categories : Maven

How do you not override other angular directives when using isolate scope and still being able to call methods in the scope?
If you want allow any global directive - don't declare private scope. If you want allow only few directives, add links in scope declaration: scope: { onClick: "&", ngShow : "&" }, To your question in comments: Declare controller in directive and declare method in this controller. Then in directive template assign ng-click to this method. var def = { restrict: 'A', controller: function($scope){ $scope.callMe = function(){ console.log('foo'); } } } in template: <div ng-click="callMe()">content</div> This method will be accessible only inside your directive.

Categories : Angularjs

ERROR [nucleusNamespace.] Invalid attempt to resolve component '' in scope global. It is defined in scope prototype
You might not be able to resolve lower scope component from higher scope object. If you are calling resolveComponent from global scope component will might not be able to resolve it. A component’s properties should always point to objects whose scope is equal to or greater than its own. Thus, global-scope component properties should only point to objects that also have global scope; session-scope component properties should only point to objects that have global or session scope; while request-scope component properties can point to objects of any scope, including request. Please read the ATG documentation below http://docs.oracle.com/cd/E35318_02/Platform.10-1-1/ATGPlatformProgGuide/html/s0205componentscopes01.html

Categories : Oracle

writing a Javascript function outside of scope to fire inside the scope
If you change you code to this: return { svg: function() { return svg; }, call: function(f) { f.call(this); } }; then it should correctly set the context within test to be d3m. Within that function you should then be able to access this.svg() to get the SVG object, but you will not be able to access the "private" lexically scoped variable svg directly, i.e.: var d3m = d3mill(); var test = function() { console.log(this.svg()); // OK console.log(svg); // not OK - undefined variable }; d3m.call(test); You could also just pass the svg parameter to f when it's called: return { svg: function() { return svg; }, call: function(f) { return f.call(this, svg); } // also added "return", just in case }; with usage: var d3m = d3mill(); var test = function(s

Categories : Javascript

Angular JS propagate child scope variable changes to parent scope
This is due to how prototypal inheritance works. When you ask for $scope.x in the child controller, it checks to see if x is defined on its scope, and if not, looks for x in the parent scope. If you assign to the child scope's x property, it only modifies the child scope. An easy way to deal with this and get the sharing behavior is to use an object or an array. function ParentCtrl($scope) { $scope.model = {x: 5, y: 5}; } function ChildCtrl($scope) { $scope.update = function(x, y) { $scope.model.x = x; $scope.model.y = y; }; } Here, the changes will be visible in both scopes, because $scope.model will refer to the same object in both parent and child scopes. John Lindquist has a video on this.

Categories : Angularjs

Why using directive behaves differently in global scope and in local scope?
The using-declaration is just that, a declaration. The using second::y; inside of main is similar to declaring a variable y in that scope which hides any other ys in global namespace scope. When you use using second::y; in global scope, you have not hidden any names, since both ys are in the same scope. Imagine your first example is like the following (please see the comments below for an explanation): namespace first { int x = 5; int y = 10; } int main () { using namespace first; // This makes first::y visible hereafter int y = 20; // This hides first::y (similar to using second::y) cout << x << endl; cout << y << endl; // Prints 20 } However, the second example is like: namespace first { int x = 5; int y = 10; } using namespace first; // Th

Categories : C++

AngularJS: Sharing scope behavior with sibling or descendant scope
You need a ChannelService.... .service('ChannelService', function () { return { changeChannel: function (scopeData, callback) { //change the channel if (angular.isFunction(callback)) { callback(); } } }; }); Usage: .controller('MyController', ['$scope', 'ChannelService', function ($scope, ChannelService) { $scope.dataForChangingChannel = {}; $scope.changeChannel = function () { //do UI stuff here ChannelService.changeChannel($scope.dataForChangingChannel, function () { //or UI stuff here, after the channel has been changed }); } }]);

Categories : Javascript

in a directive, through parent scope's function to change parents scope's value
The reason is that the click event is happening outside of the angular environment. Essentially, the changes to the scope via your call to .test('abc1d') aren't been picked up by the digest. You can force this change to be picked up by putting alert(1); s.test("abc1d"); scope.$apply(); // force angular to process your change

Categories : Angularjs

Angular JS scope issue module not reading controller scope
After studying a little more about angular I realized that $$prevSibling goes up the scope chain of the elements so if you don't have an element to go to in the next scope level then you are going to receive back a null object because there is nothing there.

Categories : Javascript

How to access parent scope from within a custom directive *with own scope* in AngularJS?
scope: false transclude: false and you will have the same scope(with parent element) $scope.$watch(... There are a lot of ways how to access parent scope depending on this two options scope& transclude.

Categories : Angularjs

Angular scope sharing scope from table row to modal
You can add many models for the same controller, if all these models used by the same DOMs that located under the scope of that controller. but ideally every model should have its controller for more readable code .

Categories : Javascript

Trying to watch outer scope from inner scope in directive not working
Since you are using setTimeout which is called outside of angular context so you have to call scope.$apply , there are two ways to solve your problem 1) Use scope.$apply() link: function(scope, elem, attr) { scope.$watch('customAttribute', function(val){ console.log(val); } setTimeout(function(){ console.log("Changed chart type name"); scope.customAttribute.name="baz"; scope.$apply(); },5000); }, 2) Wrap the function in angular $timeout link: function(scope, elem, attr) { scope.$watch('customAttribute', function(val){ console.log(val); } $timeout(function(){ console.log("Changed chart type name"); scope.customAttribute.name="baz"; },5000); },

Categories : Angularjs

Scope object doesn't change without $scope in Angularjs
The reason is you are creating a new object (and therefore a different reference) and assigning it to a local variable that was previously pointing to the same object. $scope.change = function (data) { data = { name: 'change', game:'change' }; } The data variable passed holds a reference to the same object of your $scope.data but you are assigning a local variable pointing to a reference of an object A to a new object B, locally. At that point, $scope.data still holds a reference to the same object it has before. All you are doing is changing the reference to the local variable and discarding it at the end of the function. In your specific case, it should work (using current or $scope.current). I believe you are inverting the parameter in angular.copy as it should be (source, desti

Categories : Javascript

Isolate scope functionality with $scope.$new inheritance?
It's actually really simple to do this yourself. You use the $parse service to turn an expression into a function, then just expose that function on the scope. What Angular does internally when it encounters an & scope in the directive code is just this: https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L892-L898 So you could just make a small helper function which does this three-liner for you on properties that you want. /* * Creates a child scope, turning the property names in the whatToGetter * array into getters * @param parentScope scope to inherit * @param whatToGetter array of string properties to turn into getters * of the parent on the child scope * @returns scope new child scope */ function childScope(parentScope, whatToGette

Categories : Javascript

CakeLog and scope : Restricting scope to only one logger
According CakeLog::config documentation If you don't define any scopes an adapter will catch all scopes that match the handled levels. so, debug logger write all messages with type 'types' => array('notice', 'info', 'debug'), Now how you can avoid it? Seems you have 2 ways: use CakeLog::write with custom error type CakeLog::write('soap', "REQUEST: " . $client->__getLastRequest() . " "); in this case, according documentation of CakeLog::write method integer|string $type Type of message being written. When value is an integer or a string matching the recognized levels, then it will be treated log levels. Otherwise it's treated as scope. scope and type will same and have 'soap' value, so, message will not logged in debug logger, but only in soap. leave it as now

Categories : Cakephp

Angular Link Function: $Scope vs Scope
In your specific example, it does not matter what the parameters are named in your link function. When Angular processes the directive, it will pass the scope, element and attrs (and even a controller instance if configured) to your link function. You could do this (not recommended): link: function (s, e, a) and it will work fine. $ is the prefix used by Angular. It is a convention and helps avoid naming collisions.

Categories : Javascript

isolated scope "=" affects parent scope
Yes. That is how = bindings in the isolate scope work. The directive gets its own scope, but you still need a way of communicating with the outside scope (not "parent" scope since the directive's scope is isolated). The = binding provides a two-way binding to the outside. So, when you bound your model in the directive <phone nework="network" ..., you are telling Angular to set the network value in your controller's scope. This happens inside your link function when you set isoNetwork. If you are looking for a one-way binding, consider the @ binding, which is a one-way string binding, which is different from the = binding which is a two-way reference.

Categories : Angularjs

Accessing socket.io scope from outer scope
I always use this: var userIdSocketMapper = {}; io.sockets.on('connection', function (socket) { var userId = socket.handshake.userId; userIdSocketMapper[userId] = socket; }); app.post('/:userId', function(req, res) { var socket = userIdSocketMapper[req.params.userId]; if (socket) { socket.broadcast.emit('boo', data); } });

Categories : Javascript

Why does dependency:list -DincludeScope=compile lists compile scope for transitive dependencies of test scope items
Oh, it's a bug (http://jira.codehaus.org/browse/MNG-3089) explained in this thread http://www.mail-archive.com/dev@maven.apache.org/msg68011.html but not fixed.

Categories : Maven

OAuth2 for custom API
"As far as I know, the user never have to interact with my Auth Server at all using third-party login." That's only partly true. Theoretically, you could use the token of the Third-Party login as your own. So a normal resource request would be: Client requests resource - sends token (from 3rd party) and type of login (facebook/google/etc) Server validates request by checking the token with the 3rd party Authorization Server and returns data. The downside with that is, that your API server has to talk with the 3rd party server every time a request gets made (whether data from them is needed or not). Instead when you generate your own token you have more control and it's simpler to validate requests. I would stick with your workflow though. I did something similar once and my steps were

Categories : PHP

oauth2 website on GAE
Your application is not an OAuth Consumer. Google is the provider, but your application needs to request access, you as a user need to approve it, and then your application can consume the Google APIs. Sending an OAuth token to your application doesn't get you a session cookie.

Categories : Google App Engine

Using OAuth2 in HTML5 Web App
The only way to be fully secure is to not store the access tokens client side. Anyone with (physical)access to your browser could obtain your token. 1) Your assessment of neither being a great solution is accurate. 2) Using expiration times would be your best if you are limited to only client side development. It wouldn't require your users to re-authenticate with Oauth as frequently, and guarantee that the token wouldn't live forever. Still not the most secure. 3) Getting a new token would require performing the Oauth workflow to obtain a fresh token. The client_id is tied to a specific domain for Oauth to function. The most secure method for retaining Oauth tokens would be a server side implementation.

Categories : Javascript

Intellij scope and maven scope
You need to change the working directory for the test. To do this edit click the test dropdown menu and select "edit configurations" and change the working directory to the sub-module folder for each test.

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.