Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit e3bba19

Browse files
committed
Add scope when getting an oauth token
1 parent a6191b7 commit e3bba19

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/creatubbles/client.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
class Creatubbles::Client
44
attr_writer :api_url, :username, :password
55

6-
def initialize(client_id: nil, client_secret: nil, username: nil, password: nil, api_url: Creatubbles::DEFAULT_API_URL)
6+
def initialize(client_id: nil, client_secret: nil, username: nil, password: nil, api_url: Creatubbles::DEFAULT_API_URL, scope: nil)
77
@client_id = client_id
88
@client_secret = client_secret
99
@username = username
1010
@password = password
1111
@api_url = api_url
12+
@scope = scope
1213
end
1314

1415
def connection
@@ -32,9 +33,9 @@ def #{type_name}
3233
def get_oauth_token
3334
oauth = OAuth2::Client.new(@client_id, @client_secret, site: @api_url)
3435
if @username && @password
35-
oauth.password.get_token(@username, @password)
36+
oauth.password.get_token(@username, @password, scope: @scope)
3637
else
37-
oauth.client_credentials.get_token
38+
oauth.client_credentials.get_token(scope: @scope)
3839
end
3940
end
4041
end

0 commit comments

Comments
 (0)