Problem while implementing oauth2.0

Hello, Friends !

I am implementing oauth2.0 into my web site

I think my app’s purpose does not fit with smart app

so I just tried to implement basic o auth implementation

followed this thread ↓

first, I generated app using cli app:create

and I added redirect uri like below

https://${mywebsitere}/redirect

and

export async function GET(request: Request) {
const uri = https://api.smartthings.com/oauth/authorize?client_id=${clientID}&redirect_uri=${redirectUrl}&scope=r:devices:*+w:devices:*+x:devices:*;

redirect(encodeURI(uri));
}

redirected successfully but encountered below issue.

https://starthome.kr/dev/smartthings/login/redirect?**error=unsupported_response_type**

I can’t debug what happend, so please help !!

++ I did got code when I set redirect uri to ↓
https://httpbin.org/get&scope=r:devices:*+w:devices:*+x:devices:*

I coudn’t remember totally, even with this uri I think I failed to get code in second try ,facing same issue - unsupported_response_type (I am not sure)

++ I tried delete all my cache before I try

additionally I tried set my redirect uri to localhost and 127.0.0.1
and I failed all cases with 403 forbidden error.

is there any other way to implement oAuth easy way ?
documentation is almost same with none

Please help , I am wasting my time ㅠ.ㅠ

I notice the URI you defined above didn’t include &response_type=code in the query string. That would be a problem.

The &scope=r:devices:*+w:devices:*+x:devices:* should be part of the query string for the ‘authorize’ URI. You typically specify the scope to match whatever you chose when you created the app (more precisely when you create the app you are defining the scopes you are allowed to use, when you do the ‘authorize’ step you pick which of those you actually want to use which is often the same).

@orangebucket

Thanks very much!

you saved me from my tunnel vision

It works fine :slight_smile: