{"action":"closed","issue":{"url":"https://api.github.com/repos/omab/python-social-auth/issues/645","repository_url":"https://api.github.com/repos/omab/python-social-auth","labels_url":"https://api.github.com/repos/omab/python-social-auth/issues/645/labels{/name}","comments_url":"https://api.github.com/repos/omab/python-social-auth/issues/645/comments","events_url":"https://api.github.com/repos/omab/python-social-auth/issues/645/events","html_url":"https://github.com/omab/python-social-auth/issues/645","id":88050811,"number":645,"title":"load_strategy and _do_login new method","user":{"login":"harshmaur","id":12210058,"avatar_url":"https://avatars.githubusercontent.com/u/12210058?v=3","gravatar_id":"","url":"https://api.github.com/users/harshmaur","html_url":"https://github.com/harshmaur","followers_url":"https://api.github.com/users/harshmaur/followers","following_url":"https://api.github.com/users/harshmaur/following{/other_user}","gists_url":"https://api.github.com/users/harshmaur/gists{/gist_id}","starred_url":"https://api.github.com/users/harshmaur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshmaur/subscriptions","organizations_url":"https://api.github.com/users/harshmaur/orgs","repos_url":"https://api.github.com/users/harshmaur/repos","events_url":"https://api.github.com/users/harshmaur/events{/privacy}","received_events_url":"https://api.github.com/users/harshmaur/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2015-06-13T19:14:39Z","updated_at":"2016-12-27T13:01:05Z","closed_at":"2016-12-27T13:01:05Z","body":"Hi, \n\nI have been working on integrating my angularjs mobile website with django backend. \n\nI am able to send the token properly to python social auth and I am able to authenticate the user and I am getting the user model from the code\n\nBut I am not able to perform a _do_login, I have found that this is because of some code improvements in the plugin and I do not know the new implementations of the newer version. Please help me out with this. I am using 0.2.2 of psa and django 1.7.4\n\nHere is the code for my views.py. \n\n```\n@psa()\ndef auth_by_token(request, backend):\n    backend = request.backend\n    user=request.user\n    user = backend.do_auth(\n        access_token=request.DATA.get('access_token'),\n        user=user.is_authenticated() and user or None\n        )\n    if user and user.is_active:\n        return user # Return anything that makes sense here\n    else:\n        return None\n\n\n\n@csrf_exempt\n@api_view(['POST'])\n@permission_classes((AllowAny,))\ndef social_register(request):\n    auth_token = request.DATA.get('access_token', None)\n    backend = request.DATA.get('backend', None)\n    if auth_token and backend:\n        try:\n            user = auth_by_token(request, backend)\n        except Exception, err:\n            return Response(str(err), status=400)\n        if user:\n            # TO FIX STRATEGY LOGIC.\n            strategy = load_strategy(request=request, backend=backend)\n            _do_login(strategy, user)\n            return Response( \"User logged in\", status=status.HTTP_200_OK )\n        else:\n            return Response(\"Bad Credentials\", status=403)\n    else:\n        return Response(\"Bad request\", status=400)\n\n```\n"}}
{"actor":{"display_login":"omab"}}