Security Assertion Markup Language (SAML) Vs. OAuth 2.0 and OpenID Connect (OIDC)

Pragya Sapkota
2 min readApr 13, 2023

We previously discussed Security Assertion Markup Language (SAML), OAuth 2.0, and OpenID Connect individually. In this one, we will discuss the differences between these authentication protocols.

While OAuth 2.0 and OpenID Connect use JSON to pass the messages, SAML uses XML.

The former provides us simple and better user experience and the latter is more focused on enterprise security. This happens because OAuth 2.0 and OpenID Connect have RESTful communication to support mobile applications as well. Whereas SAML keeps a session cookie in the browser to provide the access to certain web pages which is good for short-lived workloads but not for long ones.

Further, OpenID Connect is simpler to implement which expands the range of use cases for it to higher levels. They are also developer friendly and can be developed from scratch at a speed with the help of freely available libraries in most common programming languages. On the other hand, SAML is complicated — both installation and maintenance-wise. Due to this reason, it is mostly enterprise-size companies that look at SAML implementation.

OpenID Connect lies on top of the OAuth framework which means it offers a built-in layer of permission that asks a user to agree about what service provider might access. However, SAML also allows consent flow with the help of hard coding carried out by a developer but not part of its protocol.

Conclusion

These authentication protocols are better at what they do and as a developer, we need to know about our use cases and target audience before deciding on a specific protocol for the system.

I hope this article was helpful to you.

Please remember to applaud this article and follow me!!!

Any kind of feedback or comment is welcome!!!

You can also subscribe to my stories via email to get notified whenever I bring out an article on a new subject.

Thank you for your time and support!!!!

Keep Reading!! Keep Learning!!!

--

--