Skip to content

Commit 6815e19

Browse files
Update client authentication documentation
The changes simplify and clarify how client authentication works, making it clearer that auth happens automatically on client creation rather than lazily on first API call.
1 parent 7eb8696 commit 6815e19

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

README.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,21 @@ Fripa.config.verify_ssl = false
6565

6666
### Creating a Client
6767

68-
Create a client instance with user credentials. Each client maintains its own session:
68+
Create a client instance with user credentials. The client authenticates immediately upon creation:
6969

7070
```ruby
7171
client = Fripa::Client.new(
7272
username: 'your-username',
7373
password: 'your-password'
7474
)
75+
# Client is now authenticated and ready to use
7576
```
7677

77-
The client will automatically authenticate when making API calls.
78-
79-
### Manual Authentication (Optional)
80-
81-
If you need to authenticate manually:
82-
83-
```ruby
84-
client.authenticator.login!
85-
# The session cookie is now stored in the client
86-
puts client.session_cookie
87-
```
88-
89-
If authentication fails, a `Fripa::AuthenticationError` will be raised:
78+
If authentication fails, a `Fripa::AuthenticationError` will be raised immediately:
9079

9180
```ruby
9281
begin
93-
client.authenticator.login!
82+
client = Fripa::Client.new(username: 'admin', password: 'wrong-password')
9483
rescue Fripa::AuthenticationError => e
9584
puts "Authentication failed: #{e.message}"
9685
end

0 commit comments

Comments
 (0)