def signin(): # Issues authorization code username = request.form.get('username') password = request.form.get('password') client_id = request.form.get('client_id') redirect_url = request.form.get('redirect_url') code_challenge = request.form.get('code_challenge') state = request.form.get('state') if None in [ username, password, client_id, redirect_url, code_challenge, state ]: return json.dumps({"error": "invalid_request"}), 400 if not verify_client_info(client_id, redirect_url): return json.dumps({"error": "invalid_client"}) # Do the database check over here if not authenticate_user_credentials(username, password): return json.dumps({'error': 'access_denied'}), 401 authorization_code = generate_authorization_code(client_id, redirect_url, code_challenge, state) url = process_redirect_url(redirect_url, authorization_code, state) return redirect(url, code=303)
def signin(): # Issues authorization code username = request.form.get("username") password = request.form.get("password") client_id = request.form.get("client_id") redirect_url = request.form.get("redirect_url") if None in [username, password, client_id, redirect_url]: return json.dumps({"error": "invalid_request"}), 400 if not verify_client_info(client_id, redirect_url): return json.dumps({"error": "invalid_client"}) if not authenticate_user_credentials(username, password): return json.dumps({"error": "access_denied"}), 401 authorization_code = generate_authorization_code(client_id, redirect_url) url = process_redirect_url(redirect_url, authorization_code) return redirect(url, code=303)