Invalid token when configuring SAML

Folks, I need help to figure out what is going on with my redash SAML configuration. We use google as our identity provider and since they don’t provide an endpoint to serve their metadata URL. I basically downloaded the IDP metadata and spun a link in my nginx container pointing to the file in my case index.xml. but i keep seeing a parse error “not well formed invalid token” in the logs when i try to sign in using SAML. Can anyone please help with what i might be doing wrong. I am running a V 8.0.0.b32245 on docker


here are the server logs:

[2020-06-12 17:02:31,516][PID:12][DEBUG][saml2.httpbase] Response status: 200
[2020-06-12 17:02:31,518] ERROR in app: Exception on /saml/login [GET]
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/flask/”, line 1982, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/”, line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python2.7/site-packages/flask_restful/”, line 271, in error_router
return original_handler(e)
File “/usr/local/lib/python2.7/site-packages/flask/”, line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/local/lib/python2.7/site-packages/flask/”, line 1612, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python2.7/site-packages/flask/”, line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File “/app/redash/authentication/”, line 106, in sp_initiated
saml_client = get_saml_client(current_org)
File “/app/redash/authentication/”, line 56, in get_saml_client
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 356, in load
self.load_complex(cnf, metadata_construction=metadata_construction)
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 296, in load_complex
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 400, in load_metadata
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 922, in imp
self.load(key, **val)
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 910, in load
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 754, in load
return self.parse_and_check_signature(_txt)
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 635, in parse_and_check_signature
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 522, in parse
self.entities_descr = md.entities_descriptor_from_string(xmlstr)
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 1859, in entities_descriptor_from_string
return saml2.create_class_from_xml_string(EntitiesDescriptor, xml_string)
File “/usr/local/lib/python2.7/site-packages/saml2/”, line 91, in create_class_from_xml_string
tree = defusedxml.ElementTree.fromstring(xml_string)
File “/usr/local/lib/python2.7/site-packages/defusedxml/”, line 131, in fromstring
File “/usr/local/lib/python2.7/xml/etree/”, line 1659, in feed
File “/usr/local/lib/python2.7/xml/etree/”, line 1523, in _raiseerror
raise err
ParseError: not well-formed (invalid token): line 3, column 1

Have you checked index.xml with an XML parser to see if it’s valid?

thank you for that. that actually pointed to where my issue is which was white spaces in my xml file as a result of directly copying from my text editor.

1 Like