0

I cannot understand how this works:

from flask import Flask, redirect

oauth_uri = 'https://accounts.freelancer.com/oauth/authorise'
client_id = '<CLIENT_ID>'
redirect_uri = '<CLIENT_REDIRECT_URI>'
prompt = 'select_account consent'
advanced_scopes = '1 3'

app = Flask(__name__)

# Users who hit this endpoint will be redirected to the authorisation prompt
@app.route('/authorize')
def handle_authorize():
    return redirect(
        '{0}?response_type=code'
        '&client_id={1}&redirect_uri={2}'
        '&scope=basic&prompt={3}'
        '&advanced_scopes={4}'.format(
            oauth_uri, client_id, redirect_uri, prompt, advanced_scopes
        )
    )

This code gives me : Invalid redirect URI in browser. Whats this redirect URI, why can't I give any redirect uri of my choice? Its documented here: can anyone please explain to me how this works, https://developers.freelancer.com/docs/authentication/generating-access-tokens#header-receive-authorisation-response

4

1 回答 1

1

重定向 URL 是您在应用仪表板上为应用程序设置的 URL。您需要为 Freelancer.com 指定一个有效的 URL,以便在用户授予您的应用程序访问权限后重定向到。想想 Facebook 如何使用他们的登录系统授予对第三方应用程序的访问权限。

于 2017-12-28T22:46:08.013 回答