def __get_client_token(request): try: social_auth = request.user.social_auth.get() return { 'access_token': get_access_token(social_auth), 'token_type': get_token_type(social_auth), 'expires_in': __get_session_expiry_age(request), } except UserSocialAuth.DoesNotExist: raise exceptions.UserTypeException(request.user)
def config(request): '''Render the config file''' res = requests.get(settings.HBP_ENV_URL) config = res.json() # Use this app client ID config['auth']['clientId'] = auth_settings.SOCIAL_AUTH_HBP_KEY # Add user token informations config['auth']['token'] = { 'access_token': _get_access_token(request), 'token_type': get_token_type(request.user.social_auth.get()), 'expires_in': request.session.get_expiry_age(), } return JsonResponse(config)
def config(request): '''Render the config file''' res = requests.get(settings.HBP_ENV_URL) config = res.json() # Use this app client ID config['auth']['clientId'] = settings.SOCIAL_AUTH_HBP_KEY # Add user token information config['auth']['token'] = { 'access_token': get_access_token(request.user.social_auth.get()), 'token_type': get_token_type(request.user.social_auth.get()), 'expires_in': request.session.get_expiry_age(), } config['build'] = settings.BUILD_INFO return HttpResponse(json.dumps(config), content_type='application/json')
def config(request): '''Render the config file''' res = requests.get(settings.HBP_ENV_URL) config = res.json() # Use this app client ID config['auth']['clientId'] = settings.SOCIAL_AUTH_HBP_KEY # Add user token informations request.user.social_auth.get().extra_data config['auth']['token'] = { 'access_token': get_access_token(request.user.social_auth.get()), 'token_type': get_token_type(request.user.social_auth.get()), 'expires_in': request.session.get_expiry_age(), } config['build'] = settings.BUILD_INFO return HttpResponse(json.dumps(config), content_type='application/json')