awwa / sendgrid4r

MIT License
25 stars 12 forks source link

When I use api_key:, client.get_user_account does not work #32

Closed mikodayo closed 8 years ago

mikodayo commented 8 years ago

Thank you for the development of Sendgrid4r .

When I use api_key, It return 403 Forbidden.

client = Client.new(api_key: _my_api_key_ ) 
client.get_user_account

When I use Legacy, It return correct value. struct SendGrid4r::REST::Users::Account type="free", reputation=98

client = Client.new(username: _my_usename_ ,  password: _my_password_)
client.get_user_account

What is the difference ?

awwa commented 8 years ago

Does your API key has the appropriate permission? https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/api_key_permissions_list.html#User-Settings

mikodayo commented 8 years ago

Thank you for answering. You pointed out is correct.

When I made ​​a api_key on the screen, I gave all of the authority. So, I thought legacy's permssion == api_key's permission, But It was different. client.get_permissions Why We can't change user's authority on the screen? I will ask sendgrid support.

日本語ですみません。画面でapi_keyにフル権限を振って全権限が付与されいていると 思っていました。ありがとうございました!サポートに確認の後、また書き込みます。

mikodayo commented 8 years ago

Sendgrid support say as follow.

Not all API permissions can be set by the UI at this time (something we're working on adding...) so you'll need to use this(https://sendgrid.com/docs/API_Reference/Web_API_v3/API_Keys/index.html#Update-the-name-amp-scopes-of-an-API-Key-PUT) API call to update and add this desired scope.

My problem has been solved. Thank you. So I will close this issue.

awwa commented 8 years ago

Thanks for the feedback! ありがとうございました!