繁体   English   中英

如何获取访问令牌Dropbox用户IOS

[英]How to get access token Dropbox User IOS

我几乎可以使用dropbox框架进行连接,断开连接,下载等操作。我想获取访问令牌,但以下方法返回null

在.m文件之一中

//try to get access token
    MPOAuthCredentialConcreteStore *credentials=[[MPOAuthCredentialConcreteStore alloc] init];
    NSLog(@"access token %@",credentials.accessToken);

知道如何让用户访问令牌吗?

您可能不会获得accessToken,但可以获得用户信息

[self.restClient loadAccountInfo];



- (void)restClient:(DBRestClient*)client loadedAccountInfo:(DBAccountInfo*)info {
    NSLog(@"UserID: %@ %@", [info displayName], [info userId]);
}

您可以通过此委托获取访问令牌。

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{

    if ([[DBSession sharedSession] handleOpenURL:url])
    {
        if ([[DBSession sharedSession] isLinked])
        {
            // At this point you can start making API calls

            NSLog(@"App linked successfully!");
    }
    // Add whatever other url handling code your app requires here
    }
    return NO;
}

返回的网址具有访问令牌,秘密令牌和用户ID

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM