box-ios-sdk
box-ios-sdk copied to clipboard
BOXContentClient.accessTokenDelegate Can not be setted in 2.0.2
We use appUser to present a box file content, and manage accesstoken for our own.
In elder verison, I use BOXContentClient.default().authenticate() and wait the callback func:
func fetchAccessToken(completion: ((String?, Date?, Error?) -> Void)!)
In this func, I will return the accessToken and expiredDate to pass the authentication. But in v2.0.2 , the authenticate() didn't call this fetchAccessToken anymore.
Search in source code, I found that the accessTokenDelegate didn't has a setter. Only a getter in BOXContentClient.m :
When debuging my code, I found that even if I set the delegate , this var still nil .
Is that a error for the BOX? Or how could I use appuser to present a box file?
I can confirm, it's not calling fetchAccessToken any more. @wangqiwei66 I went back to 2.0.0 as that version is working fine.
I can confirm, it's not calling fetchAccessToken any more. @wangqiwei66 I went back to 2.0.0 as that version is working fine.
Exactly. Now I can only rollback to 2.0.0. Pending on BOX team to fix the issue: add a setter for BOXContenClient.accessTokenDelegate var .
@cburnette Do you have context on this?
@cburnette Any update for this issue?
@wangqiwei66 I just want to preview box files in swift ,I have accessToken and boxFileID. please let me know how to launch the box page in BoxpreviewSDK
Thanks,
You might want to try instantiating a BOXContentClient with:
- (BOXContentClient *)clientForServerAuthUser:(nonnull ServerAuthUser *)serverAuthUser initialToken:(nullable NSString *)token fetchTokenBlockInfo:(nullable NSDictionary *)fetchTokenBlockInfo fetchTokenBlock:(nonnull ServerAuthFetchTokenBlock)fetchTokenBlock;
and have your logic in fetchTokenBlock.
Looks like with the recent change, we don't need accessTokenDelegate anymore @cburnette?
You might be interested in https://github.com/box/box-ios-sdk/blob/master/doc/BoxPlatform.md
You might be interested in https://github.com/box/box-ios-sdk/blob/master/doc/BoxPlatform.md
1, If fetchAccessToken callback is deprecated, why I can see the code remains in BoxClient.h?
DO you even think about the version compliance?
2, How could I initial a serverAuthUser? We don't have a unique id or login string.
@wangqiwei66 I've just updated https://github.com/box/box-ios-sdk/blob/master/doc/BoxPlatform.md — it should now contain working sample code in both Swift and Objective-C for instantiating a client using Server-to-Server auth. The unique ID you use can be any value, as long as it uniquely identifies the user you're authorizing. If you're just doing testing or don't have multiple users, you can use a dummy value like "DUMMY_USER_IDENTIFIER"
.
Unfortunately, the change made previously to improve support for App Users did contain some changes that were not backwards compatible. I'll try to clean some of those up in the next week or so, but you should regard the instructions in https://github.com/box/box-ios-sdk/blob/master/doc/BoxPlatform.md as authoritative. The way described there is the way that App Users will work in this SDK for the foreseeable future; the previous way using accessTokenDelegate
is no longer supported.
@mattwiller copy your swift code of let fetchToken. CAN NOT even pass the compile:
@mattwiller you need add a ? for the completion:
@wangqiwei66 We're in the process of cleaning up this interface and making those parameters non-optional, since they will always be passed to the ServerAuthFetchTokenBlock
. Because of this, the documentation is slightly ahead of the latest released SDK version. You're right, you should be able to get around it for now by making these parameters optional. In the next SDK version, the parameters will no longer be optional.
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box iOS SDK and feel free to open another PR/issue at any time.