You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.8 KiB
JavaScript

/**
* This framework is intended to work and handle authentication with the cloud view engine
* DEPENDENCIES :
* rpc.js HttpClient, urlparser
* @TODO: A registration process maybe required
*/
/**
* @param id service identifier
* @param key callback/ user key
*/
jx.cloudview = { popup:null,cache: {},oauth:{}}
jx.cloudview.oauth.init = function (id, key,callback) {
var url = "https://the-phi.com/cloud-view/" +id+"/get"
var httpclient = HttpClient.instance()
httpclient.setHeader("platform",navigator.appName)
httpclient.post(url, function (x) {
var url = x.responseText
var oauth_uri = url.match(/redirect_uri=(.+)&/)[1];
url = url.replace(oauth_uri, key)
jx.cloudview.handler = null
jx.cloudview.popup = window.open(url, 'oauth', 'width=405, height=900')
var url = (["https://the-phi.com/cloud-view/", p.state, "/set/authentication"]).join('')