Why do I get a redirect URI mismatch when trying to log into Box?

十年热恋 提交于 2019-12-06 04:19:47

问题


When using the Box SDK for iOS to do OAuth, I am shown a webpage with this error:

Error: redirect_uri_mismatch

response_type=code redirect_uri=boxsdk-our4iypzazstfpx8j70e8tlc3eyn9c4l://boxsdkoauth2redirect state=ok client_id=our4iypzazstfpx8j70e8tlc3eyn9c4l

I used the code that they suggested:

[self
    presentViewController:[[BoxAuthorizationViewController alloc]
        initWithAuthorizationURL:[[BoxSDK sharedSDK].OAuth2Session authorizeURL]
        redirectURI:nil
    ]
    animated:YES
    completion:nil
];

My client ID and client secret are set prior to this. In my info.plist file, I have boxsdk-our4iypzazstfpx8j70e8tlc3eyn9c4l as a URL scheme. The only instruction I could not follow is:

Note: When setting up your service on Box, leave the OAuth2 reditrect URI blank. The SDK will provide a custom redirect URI when issuing OAuth2 calls; doing so requires that no redirect URI be set in your service settings.

When I attempt to leave the redirect URI blank and save the form in the developer console, I get the this error:

OAuth2 redirect URL must specify a valid URL and must not be http://

So I am forced to input something. I have inputted "https://mydomain.com" (with my real domain). I modified the iOS code to pass that URI into the BoxAuthorizationViewController, but I still get the same error webpage.


回答1:


Sorry, this was a mistake in our documentation. It should work if you enter boxsdk-YOUR_CLIENT_ID://boxsdkoauth2redirect into the developer console for your redirect_uri, replacing YOUR_CLIENT_ID with your actual client ID.



来源:https://stackoverflow.com/questions/25024693/why-do-i-get-a-redirect-uri-mismatch-when-trying-to-log-into-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!