Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?