Updated authorization process (cause of wrong release application bundle)
This commit is contained in:
parent
65d585df3c
commit
4271ade5d5
|
|
@ -71,7 +71,7 @@ static NSString *const REDIRECT_URL = @"https://oauth.vk.com/blank.html";
|
|||
scope:(NSString *)scope
|
||||
revoke:(BOOL)revoke
|
||||
display:(NSString *)display {
|
||||
return [NSString stringWithFormat:@"https://oauth.vk.com/authorize?client_id=%@&scope=%@&redirect_uri=%@&display=%@&v=%@&response_type=token&revoke=%d", clientId, scope, redirectUri, display, VK_SDK_API_VERSION, revoke ? 1:0];
|
||||
return [NSString stringWithFormat:@"https://oauth.vk.com/authorize?client_id=%@&scope=%@&redirect_uri=%@&display=%@&v=%@&response_type=token&revoke=%d&sdk_version=%@", clientId, scope, redirectUri, display, VK_SDK_API_VERSION, revoke ? 1:0, VK_SDK_VERSION];
|
||||
}
|
||||
|
||||
#pragma mark View prepare
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ typedef enum : NSUInteger {
|
|||
@implementation VKSdk
|
||||
static VKSdk *vkSdkInstance = nil;
|
||||
static NSString * VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_DONT_TOUCH_THIS_PLEASE";
|
||||
static NSString * VK_AUTHORIZE_URL_STRING = @"vkauthorize://authorize";
|
||||
#pragma mark Initialization
|
||||
+ (void)initialize {
|
||||
NSAssert([VKSdk class] == self, @"Subclassing is not welcome");
|
||||
|
|
@ -122,19 +123,18 @@ static NSString * VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_
|
|||
|
||||
if (!inApp) {
|
||||
NSURL *urlToOpen = [NSURL URLWithString:
|
||||
[NSString stringWithFormat:@"vkauth://authorize?client_id=%@&scope=%@&revoke=%d",
|
||||
clientId,
|
||||
[permissions componentsJoinedByString:@","], revokeAccess ? 1:0]];
|
||||
[NSString stringWithFormat:@"%@?client_id=%@&scope=%@&revoke=%d&sdk_version=%@", VK_AUTHORIZE_URL_STRING, clientId, [permissions componentsJoinedByString:@","], revokeAccess ? 1:0, VK_SDK_VERSION]
|
||||
];
|
||||
if (!forceOAuth && [[UIApplication sharedApplication] canOpenURL:urlToOpen]) {
|
||||
[VKSdk instance].authState = VKAuthorizationVkApp;
|
||||
}
|
||||
else {
|
||||
|
||||
urlToOpen = [NSURL URLWithString:[VKAuthorizeController buildAuthorizationUrl:[NSString stringWithFormat:@"vk%@://authorize", clientId]
|
||||
clientId:clientId
|
||||
scope:[permissions componentsJoinedByString:@","]
|
||||
revoke:revokeAccess
|
||||
display:@"mobile"]];
|
||||
urlToOpen = [NSURL URLWithString:
|
||||
[VKAuthorizeController buildAuthorizationUrl:[NSString stringWithFormat:@"vk%@://authorize", clientId]
|
||||
clientId:clientId
|
||||
scope:[permissions componentsJoinedByString:@","]
|
||||
revoke:revokeAccess
|
||||
display:@"mobile"]];
|
||||
[VKSdk instance].authState = VKAuthorizationSafari;
|
||||
}
|
||||
[[UIApplication sharedApplication] openURL:urlToOpen];
|
||||
|
|
@ -148,7 +148,7 @@ static NSString * VK_ACCESS_TOKEN_DEFAULTS_KEY = @"VK_ACCESS_TOKEN_DEFAULTS_KEY_
|
|||
}
|
||||
}
|
||||
+(BOOL) vkAppMayExists {
|
||||
return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"vkauth://authorize"]];
|
||||
return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:VK_AUTHORIZE_URL_STRING]];
|
||||
}
|
||||
|
||||
#pragma mark Access token
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@
|
|||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#define VK_SDK_VERSION @"1.0.6.14"
|
||||
#define VK_SDK_VERSION @"1.0.7"
|
||||
#define VK_SDK_API_VERSION @"5.21"
|
||||
|
|
|
|||
Loading…
Reference in New Issue