w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Spring Social Twitter Auth in one step
There is no way to get user email using Twitter API. You need to ask user to give his email in your application directly. You can try to simplify OAuth2 dance using implicit flow feature. See these links for more details: OAuth2: the Implicit Flow, aka as the Client-Side Flow Google Accounts: Using OAuth 2.0 for Client-side Applications But I am not sure that you can do it without any redirect at all. From Google link it looks like you have redirect in popup option. Hope it helps.

Categories : Misc

django-social-auth: How can I implement more provider?
A backend like this should do the work: from social_auth.backends.facebook import FacebookAuth, FacebookBackend class FacebookBackendForAdmins(FacebookBackend): name = 'facebook-admins' class FacebookAuthForAdmins(FacebookAuth): AUTH_BACKEND = FacebookBackendForAdmins SCOPE_VAR_NAME = 'FACEBOOK_ADMIN_EXTENDED_PERMISSIONS' Then define the setting: FACEBOOK_ADMIN_EXTENDED_PERMISSIONS = ['email', 'publish_stream', 'manage_pages'] And don't forget the setting for non-admin users: FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'publish_stream'] And also add it to AUTHENTICATION_BACKENDS setting (assuming that you add that code into yourapp/facebook_backend_for_admins.py): AUTHENTICATION_BACKENDS = ( ... 'yourapp.facebook_backend_for_admins.FacebookBackendForAdmins',

Categories : Django

django social auth limiting user data
That's because the default scope used on google backend is set to that (email and profile information), it's defined here. In order to avoid that you can create your own google backend which just sets the desired scope, then use that backend instead of the built in one. Example: from social_auth.backends.google import GoogleOAuth2 class SimplerGoogleOAuth2(GoogleOAuth2): DEFAULT_SCOPE = ['https://www.googleapis.com/auth/userinfo.email']

Categories : Django

Django social auth facebook : value of SIte URL for locahost?
What kind of URL is this - http://www.localhost.com:9000/home? I think this is what you should write- http://localhost:9000/home. But make sure, your app is in Sandbox mode; since you are running your app on the local server.

Categories : Facebook

Django Social Auth Partial Pipeline: AuthTokenError
Try this way: def gather_extra_data(backend, details, uid, request, user=None, is_new=False, *args, **kwargs): If not user is None and is_new: #is_new is your missing argument. if not details.get('email'): if not request.session.get('saved_email'): return redirect(request_extra, backend=backend.name) else: details['email'] = request.session['saved_email'] details['password'] = request.session['password'] details['first_name'] = request.session['first_name'] details['last_name'] = request.session['last_name'] details['dob'] = request.session['dob'] details['gender'] = request.session['gender'] details['avatar_url'] = request.session['avatar_url']

Categories : Django

django social auth error after completing pipeline
A good place to start would be to look in social-auth's views.py, at the few places where the redirect to LOGIN_ERROR_URL happens (the variable url is set to LOGIN_ERROR_URL and then HttpResponseRedirect(url) is called). Add some print statements, or better, set breakpoints using the python debugger. If you run your app in the Django development server, the print statements will show up in the terminal in which you ran the server. Otherwise, they may show up in your server logs, depending on your configuration. You may also find django-debug-toolbar helpful. Using print statements or the debugger, my workflow would be: Figure out what line in views.py the redirect is triggered from Figure out what condition causes that line to be reached Inspect the variables leading to that condition

Categories : Django

Is there any embeddable API for OpenAuth or any other social network auth method?
I think that OAuth could be used for it: https://developers.facebook.com/docs/reference/dialogs/oauth/ There is util, which allow use OAuth from bash script: https://github.com/livibetter/bash-oauth You can try rewrite it from Twitter and bash to Facebook and your platform.

Categories : C

Django Social Auth redirects to error page
Nothing is your settings is standing out as being incorrect. I remember having similar issues getting Facebook and django-social-auth to play nicely together when I first implemented it. The problem ended up not being with Django or django-social-auth, but rather with how my app was configured on Facebook's end. If this is a problem you are only experiencing in a test environment (localhost), then try reading this post and see if it helps resolve your issue; the culprit may be that the Site URL on Facebook is set to localhost (which Facebook does not support).

Categories : Django

Disable user registration with django-social-auth
You can make that possible by overriding the pipeline setting with one that drops create_user entry (there's an example in the pipeline docs at http://django-social-auth.readthedocs.org/en/latest/pipeline.html). Basically define this setting: SOCIAL_AUTH_PIPELINE = ( 'social_auth.backends.pipeline.social.social_auth_user', 'social_auth.backends.pipeline.social.associate_user', 'social_auth.backends.pipeline.social.load_extra_data', 'social_auth.backends.pipeline.user.update_user_details' ) Also you could add your own entry that does the check for you, like this: def user_must_exists(user=None, *args, **kwargs): if user is None: raise YourExceptionHere()

Categories : Python

Django-social-auth extended facebook permissions like spotify
Django-social-auth has been superseded by python-social-auth. In python-social-auth, you define extended permission by using SOCIAL_AUTH_FACEBOOK_SCOPE inside settings.py. For example: SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'user_photos'] It will only show a single authorization dialog.

Categories : Python

django-social-auth gives 502 error with Google OpenID, but only with a few users
VICTORY!!! After researching a little I found out that uwsgi has a --daemonize option that will direct uwsgi logs to a file. After enabling that, I started to see an error like `invalid request block size: 4167 (max 4096)...skip So I added another config option: buffer-size = 8192 And the problem went away. Thanks a lot to Bastian who helped me debug this problem!

Categories : Python

Can't dynamically redirect to last visited page with django social auth
According to source code all you need is to set ?next=. Like {% url socialauth_begin 'facebook' %}?next={{ request.get_full_path }} or another field name if setted REDIRECT_FIELD_NAME

Categories : Django

Facebook does not logout when using django-social-auth social_auth disconnect
socialauth_disconnect will remove the association between the Facebook account and the User account in your application, as if the user never hit the socialauth_begin link. There's no way from django-social-auth to logout your Facebook account, to make that possible the Facebook SDK might be needed (never did that so I'm not 100% sure), since to make that possible I guess some cookies will be removed, and to do that the script must come from the same domain.

Categories : Django

Django Social Auth:Get email from linkedin,twitter & facebook
Twitter doesn't disclose emails, to retrieve Facebook email you need to define FACEBOOK_EXTENDED_PERMISSIONS = ['email'], LinkedIn email is retrieved automatically. Emails are stored in the user model under the email attribute. Profile picture can be stored by defining this settings: TWITTER_EXTRA_DATA = [('profile_image_url', 'profile_picture')] LINKEDIN_EXTRA_DATA = [('picture-url', 'profile_picture')] Facebook profile picture is accessible by API and not sent during the auth processes. You can define your pipeline to store it like this: from django.utils import simplejson from social_auth.utils import dsa_urlopen def facebook_profile_picture(backend, user, social_user, details, response, *args, **kwargs): if backend.name != 'facebook': return url = 'https://graph.f

Categories : Django

can't save model instance in pipeline method of django-social-auth
def load_user_data(request, user, *args, **kwargs): x = User.objects.get_or_create(id=user.id) # this is looking for specyfic User, if nothing found it will create one. In your solution x wasnt User instance, so you cant save it. x.fid = 123 x.save() # <-- Nothing changes in db . I even used force_update attribute. user.fid = 123 # User instance. user.save() # <-- it works.

Categories : Python

Unable to create tables for django-social-auth on google app engine(GAE)
I got the origin of this problem and resolved it successfully. Problem: is that we were unable to run migrate command on GAE,even we did this hom/dev/djangoTaxi# sh manage.sh migrate But this run locally and hence there is no effect on GAE. Solution: To overcome this issue just open the file manage.sh . It has some command implementation which run on GAE such as cloudcreatedb, cloudsyncdb and deploy . Hence there are no other command like migrate etc.. except the above three. So i create a custom command in manage.sh named as cloudmigratedb by adding these lines after cloudsyncdb. cloudmigratedb) export SETTINGS_MODE=prod && manage_script migrate --all ;; As it call *manage_script* method with args migrate --all Here is *manage_script* : manage_script () { env/bin/pytho

Categories : Mysql

django social auth , create user model with email as primary key
Well I am doing facebook login for my ios app. What I am doing is Login to facebook from my app and get the facebook access token Send the facebook email and access token to the django backend Then what I do is, instead of using the django default authenticate method which takes the username and password to authenticate a user, I overwrite my own authenticate method. Doing this is really easy just read Django Custom Authentication In my custom authentication class I verify the email-token pair sent from the front using fb sdk for python and that is it. After than I can login the user using the django in built login

Categories : Python

Authentication using social-auth library in grails for facebook,google,twitter
Can you try the latest Grails demo from SocialAuth 4.2 SDK If it doesn't work then you can POST issue on https://code.google.com/p/socialauth/issues/list

Categories : Grails

django-social-auth with custom user model and overridden save() method
In order to solve the problem I created a custom "pipeline" (com.mysite.apps.users.social_auth.pipeline.addFacebookDetails) in which I add the necessary data to the user model only during its creation: in settings.py: SOCIAL_AUTH_PIPELINE = ( 'social_auth.backends.pipeline.social.social_auth_user', 'social_auth.backends.pipeline.user.get_username', 'social_auth.backends.pipeline.user.create_user', 'com.mysite.apps.users.social_auth.pipeline.addFacebookDetails', 'social_auth.backends.pipeline.social.associate_user', 'social_auth.backends.pipeline.user.update_user_details', ) in com.mysite.apps.users.social_auth.pipeline.addFacebookDetails.py: def addFacebookDetails(*args, **kwargs): if kwargs['is_new']: user = kwargs['user'] user.field1 = 'fo

Categories : Django

Multiple social logins
You link multiple social login providers on email id base like user login from facebook using abc@xyz.com email id now user login from google using abc@xyz.com email id then link both provider on email id base

Categories : Facebook

Django allauth - Multiple social accounts with a custom user
Adding/connection additional accounts is documented here: http://django-allauth.readthedocs.org/en/latest/templates.html#social-account-tags Specifically, see the process parameter. Example: <a href="{% provider_login_url "twitter" process="connect" %}">Connect a Twitter account</a>

Categories : Misc

Netty - Different pipelines for different occasions?
It is currently not supported to add more then one ChannelPipeline. We plan to support "nested" pipelines at some point but not sure when exactly. For now you could modify the pipeline on the fly to meet your needs. Check out the PortUnification example which does the same: https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/portunification/PortUnificationServerHandler.java

Categories : Java

Understanding GStreamer Pipelines
In case anyone else is working on this, head over to http://docs.gstreamer.com/display/GstSDK/Playback+tutorial+6%3A+Audio+visualization. Also, if you want to specify a local file using playbin2, just set the uri parameter to file:///myfile.ogg.

Categories : C

WordPress pluggin not working with multiple instances of shortcode on the page (Social Discount Press)
I have found that the main cause of the issue was due to the pluggin being built mainly on ID's which need to be unique across the page. And having multiple instances of the same ID was causing many errors. The solution was to rewrite some of the php and js to use Classes instead of ID's. This allowed for two instances of the pluggin to work on the same page, thus solving problem number one. The reason why the google one is so inaccurate is because the author simply opens up a popup to the google share page in a popup, this doesn't allow us to see the JS events such as when we share. On the other hand because the twitter and facebook jssdk are loaded into the page, we know the exact moment when there has been either of those have been shared and thus accurately display the instan

Categories : Wordpress

Database Scheme for unified profiles fetched from multiple Social Networks (Facebook and Linkedin...)
var UserSchema = new Schema({ name: { type: String, default: '' }, email: { type: String, default: '' }, provider: { type: String, default: '' }, hashed_password: { type: String, default: '' }, salt: { type: String, default: '' }, authToken: { type: String, default: '' }, facebook: {}, linkedin: {} }) I'm using the Schema mentioned above for my users collection. and when a new user wants to Sign up, using either the local strategy or social strategies I just use the update mongoose function with the "upsert: true" option, to either update or create an entry.

Categories : Mongodb

Multiple User Types For Auth in Django
I think the easiest way for you to do what you are talking about is going to be to have 3 apps in your project: your top level app, a "professional" app and a "client" app. At the top level app, all you really need to do is give the users a login form, and 2 links, one for registering as a Professional and one for registering as a Client. In this case, I believe it will be easiest for you to use Django's built in Permissions system, and assign each type of user to a corresponding group (eg. professionals and clients). You can use a decorator on your views to ensure that only members of a particular group can access that view (since you have 2 separate apps for each group, you can add a decorator to all views in each of them, or you can import Django's authorization functions into your ur

Categories : Django

GoogleOAuth2 Auth Failure "unauthorized_client"/ Python GoogleAdWord API
Fixed it. Iam behind a proxy which makes lets the step1 Auth through but apparently not the step2 auth. So a simple h = httplib2.Http(proxy_info = httplib2.ProxyInfo PROXY DATA .....) flow.step2_exchange(code, h) fixed it.

Categories : Python

laravel basic auth not working but auth::attempt does
Yes it might well be the server configuration but generally, i would say DON'T use the basic auth in a production environment, because its as its named "basic". In a screen cast Taylor made where he explained the use, I believe him saying its useful if you want to develop authenticated control panels but don't want to go into creating a log in page just yet. That said, I think you should use a more conventional HTML log in page, and if you really want basic auth, you should manually set that up using a .htpasswd file.

Categories : Laravel

django-tastypie: why are api keys useful and how to support multiple auth schemes?
Use case: The first and use case for API keys is automation. You provide your api key (or commonly called token) to a 3rd party and voila, you can have the 3rd party do stuff for you. When you do not trust the 3rd party anymore, you can just revoke the api key or re-generate it. Api keys allow the user to initiate & authenticate the chain of actions by requesting the token via traditional authentication (e.g username/password), and then the user passes it on to the interested parties. See my little story about phone numbers at the end. Why not use passwords? Because you don't want to compromise your users on other websites and have them type their password there in order to use your APIs. If the 3rd party is compromised, then the user's communications or password are compromised. H

Categories : Django

Session creation in Google appengine (Python) - simple auth failing
In general, waiting is a poor excuse for synchronization. In either case you'll want to dig into your auth library to investigate. You don't want auth.set_session to be async. Make it synchronous. That should make life easier. Find out how get_user_by_session() works. The problem you describe sounds a lot like eventual consistency behavior. This may happen if get_user_by_session() issues a datastore query operation, which may return eventually consistent results. For your get_user_by_session() operation, you want strongly consistent results, so the library should be using a datastore get operation. In fact, since you just created the user and session, the library should have cached that information and shouldn't need to hit the datastore at all. The library being python, you shoul

Categories : Google App Engine

How to structure Python code to support multiple releases of MY project (i.e. not multiple versions of Python)
Your subprocess offers an API to the web sites. The trick is to make it so that API v2 of the subprocess code can handle calls from both v1 and v2 web sites. This is called backward compatibility. Also, it's nice if the v1 web site is not too picky about the data it receives and can for instance handle a v2 answer from the subprocess that has more information than it used to have in v1. This is called forward compatibility. Json and xml are good ways to achieve it, since you can add properties and attributes at will without harming the parsing of the old properties. So the solution, I think, does not lie in a python trick, but in careful design of the API of your subprocess such that the API will not break as the subprocess's functionality increases.

Categories : Python

Getting the Auth Token with Ember-Auth
I don't know Ember-Auth, but to access properties in objects. You have to use the get method. Whistlr.Auth.get('authToken') I hope it helps.

Categories : Authentication

CakePHP App with Auth + ACL and Plugin with Auth but no ACL
I have 2 possible suggestions for breaking the inheritence structure of CakePHP to prevent the plugin from loading the components Pseudo App Controller Create a new controller class for example MyAppController which extends the core AppController which can then be used as a parent for main app's controllers, while the core AppController which remains empty is used for the plugins. The plugins then do not inherit anything Your structure should be something like A normal AppController class // app/Controller/AppController.php class AppController extends Controller { // left empty intentionally } A pseudo-AppController for your plugin class MyAppController extends Controller { // all code for the main app // used for all your normal app controllers public $components

Categories : Cakephp

Laravel, use auth and auth.basic
Use groups and define other routes inside them. Route::group(['prefix'=>'admin', 'before'=>'auth.basic'], function(){ Route::get('/', function(){}); }); Route::group(['prefix'=>'account', 'before'=>'auth.account'], function(){ Route::get('/', function(){}); });

Categories : PHP

Python Pass multiple variables through command to change multiple lines in a text file with regex
I replaced the for loop with the following code and it worked: with open('test1.txt') as f: line1 = f.readline() line2 = f.readline() line3 = f.readline() build = re.sub ('build='r'.*','build='+buildpath,line1) apps = re.sub ('apps='r'.*','apps='+appspath,line2) logs = re.sub ('logs='r'.*','logs='+logspath,line3) tf.write(build + apps + logs)

Categories : Python

Install OpenCV for Python (multiple python versions)
Use virtualenv virtualenv -p python2.7 env source env/bin/activate python --version # prints «Python 2.7.3» pip install pyopencv If you need support of 2.4 (or other version), just create new environment.

Categories : Python

Multiple python versions: How to set default python binary
Create a symbolic link python in /usr/bin and point it to /usr/local/bin/python2.7. Something like this should work: ln -s /usr/local/bin/python2.7 /usr/bin/python Make sure you have permissions to do that. Once done, hit python command and it should get you to python 2.7 Hope this helps.

Categories : Python

python multiple inputs and multiple outputs
Loop over filenames. input_filenames = ['a.sam', 'b.sam', 'c.sam'] output_filenames = ['aout.sam', 'bout.sam', 'cout.sam'] for infn, outfn in zip(input_filenames, output_filenames): out = open('/home/directory/{}'.format(outfn), 'w') infile = open('/home/directory/{}'.format(infn), 'r') ... UPDATE Following code generate output_filenames from given input_filenames. import os def get_output_filename(fn): filename, ext = os.path.splitext(fn) return filename + 'out' + ext input_filenames = ['a.sam', 'b.sam', 'c.sam'] # or glob.glob('*.sam') output_filenames = map(get_output_filename, input_filenames)

Categories : Python

In social networking getting W3c error
I got the answer of My Question for that i need to set <!DOCTYPE HTML> <!DOCTYPE HTML> <html xmlns="http://www.w3.org/1999/xhtml"> %%Panel.HTMLHead%% <body> Now all the the error are solve it just because of the page DOCTYPE is not HTML 5 **data-buttons data-style data-counter data-hover data-promo-callout** This all attribute support in HTML5. I got this after long research. I hope this will also help to other.

Categories : Javascript

Wordpress and social sharing
According to Facebook, it scrapes your page every 24 hours to ensure the description (and other share data) are up to date. However, you can manually refresh it by entering the post URL into the Facebook URL Linter Let me know if i could help you more.

Categories : Facebook



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