# Getting Access Denied Error While fetching Auth code and token

**URL:** https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064
**Category:** Development
**Tags:** development, email
**Created:** [August 8, 2024, 5:08pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064 "2024-08-08T17:08:10Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![swurgentcare](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@swurgentcare](https://forum.mautic.org/u/swurgentcare)
#### Post date: [August 8, 2024, 5:08pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/1 "2024-08-08T17:08:10Z")

</div>

I have tried to test with my url for authorize context given in mautic documentation like;  
[campaign.swurgentcare.net](http://campaign.swurgentcare.net)  
[https://campaign.swurgentcare.net/oauth/v2/authorize](https://campaign.swurgentcare.net/oauth/v2/authorize)  
along with body parameters  
but it does not work and give html type page response.

Moreover; I tried to call token API like  
[https://campaign.swurgentcare.net/oauth/v2/token](https://campaign.swurgentcare.net/oauth/v2/token)  
with grantytpe, client-id and other params but it gives error like:  
{  
“errors”: [  
{  
“message”: “The client credentials are invalid”,  
“code”: 400,  
“type”: “invalid\_client”  
}  
]  
}

=\> I am using client id and secret in both APIs which i have created in API Credentials of my account dashboard. then why m getting this error. Need support for this

Regards,  
Maria

 ![image1](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/3a41ac25001adaf7fd85985f7073b65789067ff1.png)  
 ![image2](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/c216d0f8966d56955720b0f228b1b7f50aa77b7e.png)

---

<div class="post-metadata">

### Author: ![adiux](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/adiux/32/5793_2.png) [@adiux](https://forum.mautic.org/u/adiux)
#### Post date: [August 9, 2024, 2:57pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/2 "2024-08-09T14:57:13Z")

</div>

Hi @swurgentcare

I haven’t used this API in a while, but I double-checked my implementation. I use a GET request like this:

```auto
{{domain}}/oauth/v2/authorize?client_id=1_4923jcw2u...&grant_type=authorization_code&redirect_uri=https://...run.app&response_type=code&state=UNIQUE_STATE_STRING

```

Hope this helps.

Greetings  
Adrian

---

<div class="post-metadata">

### Author: ![adiux](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/adiux/32/5793_2.png) [@adiux](https://forum.mautic.org/u/adiux)
#### Post date: [August 9, 2024, 2:59pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/3 "2024-08-09T14:59:25Z")

</div>

And I just noticed that you have the client\_id checkbox deactivated in the printscreen of your second (token) request. Maybe you want to activate that parameter?

---

<div class="post-metadata">

### Author: ![swurgentcare](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@swurgentcare](https://forum.mautic.org/u/swurgentcare)
#### Post date: [August 12, 2024, 5:44pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/4 "2024-08-12T17:44:23Z")

</div>

As I have followed the same request as given by you, but still it gives me html page response

 ![authorize](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/506675a19e6649a6b26d049aa0330a771efce6ca.png)

---

<div class="post-metadata">

### Author: ![swurgentcare](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@swurgentcare](https://forum.mautic.org/u/swurgentcare)
#### Post date: [August 12, 2024, 5:51pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/5 "2024-08-12T17:51:55Z")

</div>

Can you guide me regarding redirect\_uri and state param values? Am I passing them right way. Although state is optional, and has not much affect may be, but what about redirect\_uri. my dashboard url is [campaign.swurgentcare.net](http://campaign.swurgentcare.net) , what would be redirect\_uri then  
My Request is like;  
curl --location ‘[Mautic](https://campaign.swurgentcare.net/oauth/v2/authorize?client_id=1_659e9cghjdogkw4408kg......&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fcampaign.swurgentcare.net&response_type=code&state=ACTIVE)’

---

<div class="post-metadata">

### Author: ![swurgentcare](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@swurgentcare](https://forum.mautic.org/u/swurgentcare)
#### Post date: [August 13, 2024, 5:50pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/6 "2024-08-13T17:50:16Z")

</div>

I got the token now by calling it directly from Authorization option in postman, having option Get New Access Token, but still unable to call /authorize api and to get json response having access\_token.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/4f6d8d586f2d5399fe65361b78ac47f4f36475b1.png)

CURL Command I tried:  
curl --location ‘[Mautic](https://campaign.swurgentcare.net/oauth/v2/authorize?client_id=2_z7alf37c16o0w8g80ogg8ggg0kc0sgokco0g8&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fcampaign.swurgentcare.net%2Foauth%2Fv2%2Fauthorize_login&response_type=code&state=null)’

---

<div class="post-metadata">

### Author: ![swurgentcare](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@swurgentcare](https://forum.mautic.org/u/swurgentcare)
#### Post date: [August 13, 2024, 5:59pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/7 "2024-08-13T17:59:07Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/dfee62e7da983db5a3287a6c3e2396452d17ad6c.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/43abb46dacfff40ee95d042c46ac8082763a1389.png)

---

<div class="post-metadata">

### Author: ![zank](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/zank/32/12706_2.png) [@zank](https://forum.mautic.org/u/zank)
#### Post date: [September 11, 2024, 7:53pm UTC](https://forum.mautic.org/t/getting-access-denied-error-while-fetching-auth-code-and-token/33064/8 "2024-09-11T19:53:04Z")

</div>

> [@swurgentcare](#):
>
> unable to call /authorize api and to get json response having access\_token.

I am unable to call /authorize api and to get json response having access\_token.  
You can try connecting with Wix Pro Agency to solve this issue: Visit them here [https://www.wix-pro.com.au/booking-calendar](https://www.wix-pro.com.au/booking-calendar)
