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

1 Answers1

1

The redirect URL is the URL you set for your application on your apps dashboard. You need to specify a valid URL for Freelancer.com to redirect to after the user has granted access for your app. Think of how Facebook grants access to third party apps using their log in system.