OSDN Git Service

Version 0.6.158, fix X.Net.JSONP.
[pettanr/clientJs.git] / 0.6.x / js / 06_net / 10_XOAuth2.js
index ab34837..ef18be5 100644 (file)
@@ -105,14 +105,15 @@ X[ 'OAuth2' ] = X_EventDispatcher[ 'inherits' ](
                                h   = pair[ 'authorizeWindowHeight' ] || 500;
                                
                                X_NET_OAUTH2_authorizationWindow = window.open(
-                                       url + ( ( url.indexOf( '?' ) !== -1 ) ? '&' : '?' ) + X_URL_objToParam(
+                                       X_URL_create( url,
                                                {
                                                        'response_type' : 'code',
                                                        'client_id'     : pair[ 'clientID' ],
                                                        'redirect_uri'  : pair[ 'redirectURI' ],
                                                        'scope'         : ( pair[ 'scopes' ] || []).join(' ')
                                                }
-                                       ), 'oauthauthorize',
+                                       ),
+                                       'oauthauthorize',
                                        'width=' + w
                                        + ',height=' + h
                                        + ',left=' + ( screen.width  - w ) / 2
@@ -352,7 +353,7 @@ function X_NET_OAUTH2_updateRequest( oauth2, request ){
                headers;
 
        if( token && mechanism === 'param' ){
-               request[ 'url' ] = url + ((url.indexOf('?') !== -1) ? '&' : '?') + 'bearer_token=' + encodeURIComponent( token );
+               request[ 'url' ] = X_URL_create( url, { 'bearer_token' : encodeURIComponent( token ) } );
        };
        
        if( token && ( !mechanism || mechanism === 'header' ) ){