Files
scrypted/plugins/core/ui/src/interfaces/OauthClient.vue
Koushik Dutta a46b2811ed initial commit
2021-08-24 21:22:41 -07:00

30 lines
821 B
Vue

<template>
<v-btn text color="primary" @click="onClick">Login</v-btn>
</template>
<script>
import RPCInterface from "./RPCInterface.vue";
import qs from 'query-string';
export default {
mixins: [RPCInterface],
methods: {
onChange() {},
onClick: function() {
this.rpc()
.getOauthUrl()
.then(data => {
var url = new URL(data);
var querystring = qs.parse(url.search.replace("?", ""));
querystring.redirect_uri = `https://home.scrypted.app/web/oauth/callback`;
querystring.state = JSON.stringify({
d: this.device.id,
s: querystring.state,
r: window.location.toString(),
});
url.search = qs.stringify(querystring);
window.location = url.toString();
});
}
}
};
</script>