Authorization API- can't see cookie

Hi everyone, new bubbler here and i’m stuck; I’m putting together a plugin and am having trouble with an authentication call. Here are the instructions from the site who’s API i’m using.

  1. Prompt for the customer’s username and password - you might want to do this similarly to how we do it on the login page.
  1. Programmatically call the login API at: https://api.myfantasyleague.com/2019/login?USERNAME=testuser&PASSWORD=testing&XML=1, passing in a valid username and password. You must use HTTPS for this request to avoid exposing the user’s credentials.
  1. If valid information is passed into the login program, the response will include a <status cookie_name =" cookie_value "…>.
  1. If invalid information is passed into the login program, it will respond with an <error… status message.
  1. The above cookie name/value pair should be passed back in as via a standard HTTP header cookie in the format: "Cookie: MFL_USER_ID= cookie_value " in all subsequent calls to the API.
  1. Note that the cookie value is a Base64 string. That means it may contain the special symbols ‘+’, ‘/’ and/or ‘=’. Depending on your environment, you may need to explicitly URL-escape these symbols before passing them back to us (e.g. converting ‘=’ to ‘%3D’).

When i pass this all outside bubble i can see the user cookie in the source, but when i do it in bubble i don’t see the cookie (even in the “raw data”)

Here’s how i have it set up (i took out my actual user name & pw):

and the “raw data” (after I initialize call with my username/pw)

and here’s what i see when i do it outside bubble (what i want to see IN bubble)

<?xml version="1.0" encoding="utf-8"?>

< status MFL_USER_ID=“bRZi3M2bvrD1jwQ=”>OK|

any ideas?

Andy

Can you send also the full request including parameter of the one outside of bubble?
I believe you may need to set the content-type to application/x-www-form-urlencoded

You can also send the request to a requestbin (both: from bubble and from outside) and compare result/request.

Still learning APIs so bear with me if i misunderstand what you are saying.

I can send this request in a browser:
https://api.myfantasyleague.com/2019/login?USERNAME=aje1&PASSWORD=h1ghland&XML=1

and i get a webpage that says “OK”
then i can view source and see the cookie that i need listed there inside “status” code. (i’d post the code, but the <…status…> won’t show.

When i run that same request from the bubble api connector it doesn’t show me the things inside the status code.

If you activate the capture response header checkbox, you will get it in header (with the full set cookie request). You may need to parse it using regex.

hah, awesome thanks. I couldn’t even see that box. My one complain about bubble is that it’s hard to see the gray on white color scheme sometimes.

Thanks for the help!

OK, I can obtain the cookie. Can you advise on how to pass it back as a HTTP header? I’m trying but am not getting results.

got it figured out. Thx again for the help

1 Like

Hey see you figured out how to pass the cookie back in the header? Can you go into detail on that? I got the set-cookie values but not passing them back correctly apparently. tx!

1 Like