Forum Academy Marketplace Showcase Pricing Features

Implementing basic auth? Works in postman, not in bubble

I’m trying to set up the lyft API using the Bubble API connector. It uses basic auth and works in Postman, but not in Bubble.

In postman, this works:
Auth:

Headers:

Note below the body is “raw”. I think this may be part of my problem.

The curl from Lyft:

curl -X POST -H "Content-Type: application/json" \
     --user "<client_id>:<client_secret>" \
     -d '{"grant_type": "client_credentials", "scope": "public"}' \
     'https://api.lyft.com/oauth/token'

This code that results in 200 OK from Postman:

POST /oauth/token?oauth_consumer_key=1iWFuMhFLBXb&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1493140160&amp;oauth_nonce=DwAELS&amp;oauth_version=1.0&amp;oauth_signature=zuU+UbOZB0ioILGVHwjfQt/48l8= HTTP/1.1
Host: api.lyft.com
Content-Type: application/json
Authorization: Basic MWlXRnVNaEZMQlhiOkpIbjVJZE5vTVF1Q2twcWZBTEtjdFlHc3JoTnZDanJO
Cache-Control: no-cache
Postman-Token: 2ed9de39-09f7-498b-917c-a77114f5b11e
{"grant_type": "client_credentials", "scope":"public rides.request rides.read"}

Does the code above contain everything I need for the API connector? How do I see what Bubble is passing to the lyft API?

I’ve tried every combination I can think of to make this work and keep getting this error:

Any suggestions?

Thank you for your help. You are a beautiful human being.

when you see this

-d '{"grant_type": "client_credentials", "scope": "public"}' \

that means it’s in the body. Why do you put the grant_type in the header?

1 Like

You misspelled content-type replace the underscore… then it should work

I was trying anything I could. :slight_smile:

I get the same error when making the change .

Is my [quote=“emmanuel, post:2, topic:13128”]
-d ‘{“grant_type”: “client_credentials”, “scope”: “public”}’
[/quote]

I know I don’t need the -d. Do I use the tick-marks and backslash? ’ and
Or is that curl?

Yikes! Yes I did.

I was also screwing up the body syntax. Time to study curl.

Just goes to show that if you stare at something long enough, it all becomes gibberish.

Thank you