If defined, makes the user
authorization optional. If the user authorization is optional, Bixby will not automatically prompt the user to log in. If you need the user to log in, you need to trigger the login from the endpoint implementation. Here is one way you can do that:
if ($vivContext.accessToken) { // if this is present, the user is logged in
// access protected resource
http.oauthGetUrl(...);
...
} else {
var doLogin = ... // some condition if the user should login
if (doLogin) {
var err = new Error('Please log in first.');
err.$type = 'authorization-error';
err.$message = 'Unauthorized account';
throw err; // throwing a type 'authorization-error' error will trigger the login prompt
}
// Do not use oauthGetUrl here because the user is not logged in
http.getUrl(...);
...
}
Copyright 2025 Samsung All rights reserved