-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
The Procore API reference states that the only http callback URI that is acceptable is "http://localhost". The sample app uses a callback URI of "http://localhost:3000/users/home" which is rejected by the Procore API at runtime. In order to fix this I had to add the code below into the oath_main file:
callbackapp = Flask(__name__)
@callbackapp.route('/',methods=["GET", "POST"])
def app_callback1():
if request.method == "GET":
if session.get('bool') is False:
code = request.args.get('code')
cburl= f'{REDIRECT_URI}?code={code}'
return redirect(cburl)
and then run a separate python script to run it before spinning up the main server on port 3000, coded as follows:
from oauth_main import callbackapp
#------- Runs the callback application ------
callbackapp.run(debug=True, port=80)
I then had to change all functions that were sending a callback URI to Procore to use http://localhost, which I just hardcoded since it isn't optional.
these functions were:
make_authorization_url()get_token(code)
The issues are twofold:
- The Procore-Official sample app doesn't follow Procore's requirements for callback URIs and therefore is not a currently functioning sample
- The Procore API does not recognize endpoints at http://localhost/[ENDPOINT HERE] or on other ports. This should be changed to allow any endpoint or port on the local machine - it is far too limiting and clumsy to have to listen on port 80 while running everything else on a different port.
Metadata
Metadata
Assignees
Labels
No labels