Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Weather App with Swift (Retired) Pulling Data From the Web Making a Network Call

JeanEdern L
JeanEdern L
3,563 Points

Suppose the API is protected by basic authentification (username, password). How to you make a call passing the info ?

Hi, I'am making a call to an API, but the call is protected by a basic authentification (it is a rails app). How do you pass the username and the password when making the URL request ?

1 Answer

Stone Preston
Stone Preston
42,016 Points

depends on the API generally. A lot of rails APIs use token authentication. Is the API a public API with documentation? If so can you link it?