Skip to content

Commit 22578a6

Browse files
authored
fix: support other API urls for API_ONLY apps (#234)
1 parent 2fb4f46 commit 22578a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/smart-app.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,13 @@ class SmartApp {
432432
}
433433

434434
async handleOAuthCallback(request) {
435-
const oauthClient = new SmartThingsOAuthClient(this._clientId, this._clientSecret, this._redirectUri)
435+
const oauthClient = this._apiUrl && this._refreshUrl ?
436+
new SmartThingsOAuthClient(this._clientId, this._clientSecret, this._redirectUri,
437+
{
438+
baseURL: this._apiUrl,
439+
authURL: this._refreshUrl,
440+
keyApiURL: this._authorizer._keyResolver._httpKeyResolve._keyApiHost}) :
441+
new SmartThingsOAuthClient(this._clientId, this._clientSecret, this._redirectUri)
436442
const auth = await oauthClient.redeemCode(request.query.code)
437443
const ctx = await this.withContext({
438444
installedAppId: auth.installed_app_id,

0 commit comments

Comments
 (0)