# OAuth2 Redirect URI?

**URL:** https://forum.mautic.org/t/oauth2-redirect-uri/6927
**Category:** Product Support
**Created:** [December 21, 2016, 12:35pm UTC](https://forum.mautic.org/t/oauth2-redirect-uri/6927 "2016-12-21T12:35:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SomethingOrOther](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@SomethingOrOther](https://forum.mautic.org/u/SomethingOrOther)
#### Post date: [December 21, 2016, 12:35pm UTC](https://forum.mautic.org/t/oauth2-redirect-uri/6927/1 "2016-12-21T12:35:10Z")

</div>

Hi everyone,  
  
  
  
  
  
I’ll get straight to the point. I read this here: [https://developer.mautic.org/#oauth-2](https://developer.mautic.org/#oauth-2)  
  
  
  
It is my understanding that after the first step of OAuth2, Mautic redirects the user to the redirect URI while adding two GET variables - the code and the state - so it looks like this:  
  
  
  
[https://your-redirect-uri.com?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING](https://your-redirect-uri.com?code=UNIQUE_CODE_STRING&state=UNIQUE_STATE_STRING)  
  
  
  
  
  
So far so good. Now, my question is the following:  
  
  
  
How do I handle this if I already have a question mark (GET variables) in my Redirect URI?  
  
  
  
We all know that an URI with more than one question mark will not work. So, what would you recommend if my Redirect URI looked like this?  
  
  
  
[http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit](http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit)  
  
  
  
There is no way that this is going to work after Mautic appends this to it:  
  
  
  
?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING  
  
  
  
so that is ends up looking like this:  
  
  
  
[http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING](http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit?code=UNIQUE_CODE_STRING&state=UNIQUE_STATE_STRING)  
  
  
  
This has two question marks in it, and it’s clearly going to fail.  
  
  
  
So, what would you recommend? Should I try to get a Redirect URI which doesn’t already receive GET variables? Or does anyone have any better ideas?  
  
  
  
Thanks.  
  
  
  
SomethingOrOther  
  
  
  
P.S. I did manage to build a small PHP script without these GET variables and it was able to successfully authorize into Mautic and query the contacts. So I understand how the whole process works, but I don’t know what should be done if the Redirect URI already has to have GET variables by design.

---

<div class="post-metadata">

### Author: ![SomethingOrOther](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@SomethingOrOther](https://forum.mautic.org/u/SomethingOrOther)
#### Post date: [December 21, 2016, 12:35pm UTC](https://forum.mautic.org/t/oauth2-redirect-uri/6927/2 "2016-12-21T12:35:10Z")

</div>

Hi everyone,

I’ll get straight to the point. I read this here: [https://developer.mautic.org/#oauth-2](https://developer.mautic.org/#oauth-2)

It is my understanding that after the first step of OAuth2, Mautic redirects the user to the redirect URI while adding two GET variables - the code and the state - so it looks like this:

[https://your-redirect-uri.com?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING](https://your-redirect-uri.com?code=UNIQUE_CODE_STRING&state=UNIQUE_STATE_STRING)

So far so good. Now, my question is the following:

How do I handle this if I already have a question mark (GET variables) in my Redirect URI?

We all know that an URI with more than one question mark will not work. So, what would you recommend if my Redirect URI looked like this?

[http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit](http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit)

There is no way that this is going to work after Mautic appends this to it:

?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING

so that is ends up looking like this:

[http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit?code=UNIQUE\_CODE\_STRING&state=UNIQUE\_STATE\_STRING](http://your-redirect-uri.com/index.php?module=Mautic&parent=Settings&view=Edit?code=UNIQUE_CODE_STRING&state=UNIQUE_STATE_STRING)

This has two question marks in it, and it’s clearly going to fail.

So, what would you recommend? Should I try to get a Redirect URI which doesn’t already receive GET variables? Or does anyone have any better ideas?

Thanks.

SomethingOrOther

P.S. I did manage to build a small PHP script without these GET variables and it was able to successfully authorize into Mautic and query the contacts. So I understand how the whole process works, but I don’t know what should be done if the Redirect URI already has to have GET variables by design.

---

<div class="post-metadata">

### Author: ![lightweight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lightweight/32/92_2.png) [@lightweight](https://forum.mautic.org/u/lightweight)
#### Post date: [March 1, 2017, 4:22am UTC](https://forum.mautic.org/t/oauth2-redirect-uri/6927/3 "2017-03-01T04:22:28Z")

</div>

You should be able to replace the ? with an & so that you concatenate the two sets of variable.s.
