Thursday 15 January 2015

extjs - sencha touch 2 with youtube api oAuth -



extjs - sencha touch 2 with youtube api oAuth -

is there illustration of how integrate sencha touch 2 youtube api oauth? next google api docs , sencha touch 2: how can add together google+ login? illustration , used javascript based button rendering google sign on in application. run cross origin issues switching http vs https context

blocked frame origin "https://accounts.google.com" accessing frame origin "http://localhost:1841. protocols, domains, , ports must match

oauth client side web applications not back upwards http protocol authentication requests.

note: requests google's authorization server must utilize https instead of http because server accessible on ssl (https) , refuses http connections.

followed below approach:

render link redirect app google auth page. need register application google , access_token, client_id etc. in sencha touch view, add together component below: { stylehtmlcontent: true, html : '<a href="https://accounts.google.com/o/oauth2/auth?client_id=my_client_id&redirect_uri=my_redirect_uri_as_configured_in_google_console&scope=https://www.googleapis.com/auth/youtube&approval_prompt=auto&response_type=token">login youtube</a>' }

note: entire url used in anchor element must url encoded string.

redirect uri configured typically same view rendered login link. upon redirect, url contain access_token hash tag. grab url , proceed regular youtube accessing functionality. launch: function () { if ( window.location.hash ) { this.onauthredirect(); } // destroy #apploadingindicator element ext.fly('apploadingindicator').destroy(); // initialize main view ext.viewport.add(ext.create('myapp.view.main')); }, onauthredirect: function () { if (window.location.hash) { var params = window.location.hash.substring(1).split('&'); if (params[0].split('=')[0] == 'access_token') { var access_token_value = params[0].split('=')[1]; //validate access_token , proceed youtube access api stuff } } },

extjs youtube-api sencha-touch sencha-touch-2 google-oauth

No comments:

Post a Comment