# SAML auth flow and how to use the Code parameter

**URL:** <https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888>\
**Category:** Get Help\
**Created:** [August 13, 2021, 7:59am UTC](https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888 "2021-08-13T07:59:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergio.sorgente](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sergio.sorgente/32/31121_2.png) [@sergio.sorgente](https://community.auth0.com/u/sergio.sorgente)\
**Post date:** [August 13, 2021, 7:59am UTC](https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888/1 "2021-08-13T07:59:40Z")

</div>

Hello there.

I’ve configured a SAML authentication and something is not what I was expecting, so here’s a recap of the flow:

- the user land in oauth0 login page and is redirected to my IdP (in this test case is Azure, but in future I’ll need to configure also SiteMinder)
- the user correctly log into Azure and the SAML response was then sent to auth0
- auth0 correctly create the User with the information retrieved from the SAMLResponse
- the flow ends with a final redirection on my redirect\_uri, appending a CODE parameter in the URL’s query string.  
(For my experience, I think that the given CODE can be useful to retrieve a token that can help me retrieve the connected user info)

Now the question is:  
In order to retrieve, from my redirection uri location (my server), the user that do this flow, how can I do? It seems that the CODE parameter is totally useless, but please let me know.  
I also know that if I use my server as ACS and then configure the URL in my IdP, I’ll receive the SAMLResponse and can decode that, but this solution is a bit messy.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![sidharth.chaudhary](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sidharth.chaudhary/32/20686_2.png) [@sidharth.chaudhary](https://community.auth0.com/u/sidharth.chaudhary)\
**Post date:** [August 17, 2021, 6:05am UTC](https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888/2 "2021-08-17T06:05:26Z")

</div>

Hey @sergio.sorgente , Welcome to the Auth0 Community!

Code is the authorization code received from the Auth0 Authorization server which can be  
exchanged using the token endpoint from Auth0 server.  
Auth0 acts as a Service Provider which Talks SAML with your IDP and Auth0 processes the SAML response from the service provider and provides you OIDC style code to your App.

The OIDC flow you have initiated using the /authorize command will dictate what type of response you  
will receive from Auth0(code, tokens etc), check these flows:

> **[Authorization Code Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow)**
>
> Learn how the Authorization Code flow works and why you should use it for regular web apps.

Most of the time you can use our SDKs to automatically get tokens from code. Our quick starts implement most of the languages.

Let me know if this helps!

Regards,  
sidharth

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 17, 2021, 9:44am UTC](https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888/3 "2021-08-17T09:44:40Z")

</div>

Thanks for helping on this one Sid!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [September 1, 2021, 9:44am UTC](https://community.auth0.com/t/saml-auth-flow-and-how-to-use-the-code-parameter/67888/4 "2021-09-01T09:44:47Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
