# \[C2C\] How do I move on to the next step on the login page?

**URL:** <https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363>\
**Category:** Support\
**Created:** [December 1, 2021, 8:08am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363 "2021-12-01T08:08:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![notdef14](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@notdef14](https://community.smartthings.com/u/notdef14)\
**Post date:** [December 1, 2021, 8:08am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/1 "2021-12-01T08:08:04Z")

</div>

It’s being developed for testing.

It was successful to enter the Authorization URI provided to workspace.

But I don’t know how to move to the next step, the token URI.

> **[Get Started with SmartThings Schema | SmartThings Developers](https://developer-preview.smartthings.com/docs/devices/cloud-connected/st-schema/)**
>
> SmartThings Schema is the quickest method of integrating your Cloud Connected Device with SmartThings (especially if your device is already working with Alexa or Google). It defines the interactions (JSON payloads) between the SmartThings Cloud and...

According to the link above, it says to create the OAuth2 Client Application, but I’ve already built it for Google voice recognition.

[https://st\_schema\_oauth\_callback](https://st_schema_oauth_callback)

Should the above redirection link provided be redirected when login is successful?

Then, what parameters should be added when directing?

Someone please answer.

Thank you.

---

<div class="post-metadata">

**Author:** ![notdef14](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@notdef14](https://community.smartthings.com/u/notdef14)\
**Post date:** [December 1, 2021, 8:57am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/2 "2021-12-01T08:57:53Z")

</div>

I found a solution.

If you succeed in logging in, redirect it as follows.

url = redirect\_uri + “?code=” + “create\_your\_random\_auth\_code” + “&state=” + state

redirect\_uri: This is the delivered uri. (For example, https://st\_schema\_oauth\_callback))

create\_your\_random\_auth\_code: create according to the situation.

state is: uses the state data delivered.

If you redirect it to the url above, it sends a signal to the token url input in workspace.

---

<div class="post-metadata">

**Author:** ![Daniel\_Artemiev](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/daniel_artemiev/32/148429_2.png) [@Daniel\_Artemiev](https://community.smartthings.com/u/Daniel_Artemiev)\
**Post date:** [December 1, 2021, 11:03am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/3 "2021-12-01T11:03:08Z")

</div>

Thank you, so, e.g., if I got next request in Token URI

```auto
POST array (
  'client_id' => '',
  'client_secret' => '',
  'grant_type' => 'authorization_code',
  'code' => '<authorization_code>',
  'redirect_uri' => '<st_schema_oauth_callback_url>',
)

```

I need to create redirect to URI or POST/GET request?

```auto
<st_schema_oauth_callback_url>?code=my_rand_code&state=code_from_request

```

?

---

<div class="post-metadata">

**Author:** ![notdef14](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@notdef14](https://community.smartthings.com/u/notdef14)\
**Post date:** [December 2, 2021, 12:53am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/4 "2021-12-02T00:53:50Z")

</div>

No, not redirect.

You need see this link, because that step is oauth.

link : [OAuth Integrations | SmartThings Developers](https://developer-preview.smartthings.com/docs/connected-services/oauth-integrations)

If grant\_type is authorization\_code you create access\_token and refresh\_token, and save on somewhere (like DB, because it is used client auth at real time) and return like this,

```auto
{
  "access_token": "<access_token>",
  "token_type": "bearer",
  "refresh_token": "<refresh_token>",
  "expires_in": 299,
  "scope": "x:devices:* r:devices:*"
}

```

Then, you check get signal to webhook link by smartthings.

I did this far.

I may be wrong, but I hope this helps.

Sorry for my poor English skills.

---

<div class="post-metadata">

**Author:** ![erickv](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/erickv/32/230792_2.png) [@erickv](https://community.smartthings.com/u/erickv)\
**Post date:** [December 2, 2021, 4:39pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/5 "2021-12-02T16:39:46Z")

</div>

> [@notdef14](#):
>
> link : [OAuth Integrations | SmartThings Developers](https://developer-preview.smartthings.com/docs/connected-services/oauth-integrations)

This reference is accurate if we point to the data format that needs to be shared at the _POST HTTP Request_ @Daniel_Artemiev mentions, but with the difference that the installation process of _ST Schema Connectors_ occurs in opposite directions, _i.e._:

- The _ST Schema OAuth Instance_ should share the token payload in exchange for the _authorization\_code_ granted _(redirected)_ after a successful login.

Notice that this _token response_ is not intended to be redirected, as it happens with the _code_.

For a detailed reference, check the [RFC6749 / Authorization Code Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1) flow _(aka OAuth Dance 😉)_

---

<div class="post-metadata">

**Author:** ![Daniel\_Artemiev](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/daniel_artemiev/32/148429_2.png) [@Daniel\_Artemiev](https://community.smartthings.com/u/Daniel_Artemiev)\
**Post date:** [December 14, 2021, 8:14am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/6 "2021-12-14T08:14:31Z")

</div>

In the final step my server process this POST-request:

```auto
{
  'client_id' => 'zzzzz',
  'client_secret' => 'yyyyy',
  'grant_type' => 'authorization_code',
  'code' =>'aaaaaaa',
  'redirect_uri' => 'https://<st-schema-oauth-callback>'
}

```

and answers like this:

```auto
{
"token_type":"Bearer",
"access_token":"qqqqq",
"refresh_token":"bbbbbb",
"expires_in":3600,
"scope":"x:devices:* w:devices:* r:devices:*"
}

```

In the app I get error:

 ![error_screenshot_samsung](https://global.discourse-cdn.com/smartthings/original/3X/9/7/978a9da84a805cf7fb8d42b9c60ba9e07d321604.jpeg)

Help, please.

---

<div class="post-metadata">

**Author:** ![erickv](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/erickv/32/230792_2.png) [@erickv](https://community.smartthings.com/u/erickv)\
**Post date:** [December 14, 2021, 1:21pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/7 "2021-12-14T13:21:29Z")

</div>

Hi, @Daniel_Artemiev

> [@Daniel\_Artemiev](#):
>
> ```auto
> {
> "token_type":"Bearer",
> "access_token":"qqqqq",
> "refresh_token":"bbbbbb",
> "expires_in":3600,
> "scope":"x:devices:* w:devices:* r:devices:*"
> }
> 
> ```

It seems you’re missing the `state` parameter. Yes, that same `state` you handled at the initial steps of the _OAuth Dance (`/authorize` **\>** `/login` **\>** `/<redirect_uri>`)_.

One curious thing to notice is that this value isn’t referenced as required at the [RFC6749 / Code Grant Acces Token Response 4.1.4](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.4), but it is under the [Implicit Grant / Access Token Response 4.2.2](https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2) section, _i.e._:

```auto

   state
         REQUIRED if the "state" parameter was present in the client
         authorization request. The exact value received from the
         client.

```

However, this is how _SmartThings_ handles the OAuth2.0 Flow for _ST Schema Connectors_ and this parameter should be included in the token response.

Let me know if this helps!

_ **Note** : Long answer apart, this error might be triggered because your connector isn’t ready to handle [Interaction Types](https://developer-preview.smartthings.com/docs/devices/cloud-connected/interaction-types/)._

---

<div class="post-metadata">

**Author:** ![Daniel\_Artemiev](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/daniel_artemiev/32/148429_2.png) [@Daniel\_Artemiev](https://community.smartthings.com/u/Daniel_Artemiev)\
**Post date:** [December 14, 2021, 3:16pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/8 "2021-12-14T15:16:59Z")

</div>

Hi, @erickv  
I added **state** param to response, now response is like this:

```auto
{
"token_type":"Bearer",
"access_token":"eyJ0eXAiOiJ.....",
"refresh_token":"def50....",
"expires_in":3600,
"state":"eyJhbG...",
"scope":"x:devices:* w:devices:* r:devices:*"
}

```

and run server , which wait for webhook.  
The error is the same, and no requests on webhook URL .

---

<div class="post-metadata">

**Author:** ![andresg](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/andresg/32/147443_2.png) [@andresg](https://community.smartthings.com/u/andresg)\
**Post date:** [December 14, 2021, 8:09pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/9 "2021-12-14T20:09:07Z")

</div>

Hi @Daniel_Artemiev,

As @erickv suggested the error may not be triggered by the `Token response`, but maybe because your connector is unreachable. For example, I’ve faced that same issue several times when my Webhook Endpoint expires. Is it possible that your Webhook URL is not public or or it has expired?

---

<div class="post-metadata">

**Author:** ![Daniel\_Artemiev](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/daniel_artemiev/32/148429_2.png) [@Daniel\_Artemiev](https://community.smartthings.com/u/Daniel_Artemiev)\
**Post date:** [December 15, 2021, 12:58am UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/10 "2021-12-15T00:58:13Z")

</div>

Thank you , @erickv and @andresg . I used 8050 port in webhook, and as I see, the URL such this  
_[https://domain.com:8050/](https://domain.com:8050/)_ is not working. I guess the reason was in the port, right? I tried to use 443 , and get request with grantCallbackAccess, discoveryRequest and another. I cannot use another port for webhook, right?

---

<div class="post-metadata">

**Author:** ![andresg](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/andresg/32/147443_2.png) [@andresg](https://community.smartthings.com/u/andresg)\
**Post date:** [December 21, 2021, 8:16pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/11 "2021-12-21T20:16:31Z")

</div>

Hi @Daniel_Artemiev,

I’m currently analyzing this issue, and I have some questions. Are you exposing directly your server or are you trying to make use of a proxy through some tunneling service? Take into account that the second option enhances your security and allows your connector to focus on its own tasks. Maybe you can test some of these apps I use: [ngrok](https://ngrok.com/), [nginx](https://www.nginx.com/), [localtunnel](http://localtunnel.github.io/www/).

---

<div class="post-metadata">

**Author:** ![andresg](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/andresg/32/147443_2.png) [@andresg](https://community.smartthings.com/u/andresg)\
**Post date:** [December 30, 2021, 2:10pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/12 "2021-12-30T14:10:53Z")

</div>

Hi @Daniel_Artemiev,

I can now assure you that the WebHook needs to be hosted in port 443. As I said in my previous message, you can try using a proxy through some tunneling service. That way, you can host your Connector on any port you want and the WebHook in port 443.

---

<div class="post-metadata">

**Author:** ![Daniel\_Artemiev](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/daniel_artemiev/32/148429_2.png) [@Daniel\_Artemiev](https://community.smartthings.com/u/Daniel_Artemiev)\
**Post date:** [December 30, 2021, 2:47pm UTC](https://community.smartthings.com/t/c2c-how-do-i-move-on-to-the-next-step-on-the-login-page/235363/13 "2021-12-30T14:47:07Z")

</div>

Hi, @andresg

Thank you for information. Maybe it will be useful to publish the information about strong using of 443 port in your Oauth Docs or in the Developer Panel ?

The fact is that I used the already made solution for google home, and I just used a non-standard port there.
