def METHOD_NAME(invitation_token):
    """Check whether the passed token is valid and add user, role and org from invitation to membership."""
    origin = request.environ.get('HTTP_ORIGIN', 'localhost')
    try:
        user = UserService.find_by_jwt_token()
        if user is None:
            response, status = {'message': 'Not authorized to perform this action'}, \
                               http_status.HTTP_401_UNAUTHORIZED
        else:
            invitation_id = InvitationService.validate_token(invitation_token).as_dict().get('id')
            response, status = InvitationService.accept_invitation(invitation_id, user, origin).as_dict(), \
                               http_status.HTTP_200_OK  # noqa:E127
    except BusinessException as exception:
        response, status = {'code': exception.code, 'message': exception.message}, exception.status_code
    return response, status