我正在使用此代码来验证我的应用。由于明显的原因,我取出了client_secret
和client_id
。
import onedrivesdk
redirect_uri = "http://localhost:8080/"
client_secret = "client secret"
client_id="client id"
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
http_provider=http_provider,
client_id=client_id,
scopes=scopes)
client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
auth_url = client.auth_provider.get_auth_url(redirect_uri)
# Ask for the code
print('Paste this URL into your browser, approve the app\'s access.')
print('Copy everything in the address bar after "code=", and paste it below.')
print(auth_url)
code = input('Paste code here: ')
client.auth_provider.authenticate(code, redirect_uri, client_secret)
它提供了URL,但是当我将其粘贴到浏览器中时,我收到了一条来自Microsoft的消息,说“我们无法完成您的请求 Microsoft帐户遇到技术问题。请稍后重试。”
有人可以帮忙吗? redirect_uri是否有问题?