Che ne dite di creare un nuovo ambito specifico, con un terzo parametro per indicare ‘parametro GET consentito’? In questo modo, gli utenti non potranno abusarne per altri scopi (ad esempio, aggirare CORS e richiedere l’API di Discourse da un altro sito).
(da qui)
SCOPES = {
read: [:get],
write: [:get, :post, :patch, :put, :delete],
message_bus: [[:post, 'message_bus']],
push: nil,
one_time_password: nil,
notifications: [[:post, 'message_bus'], [:get, 'notifications#index'], [:put, 'notifications#mark_read']],
session_info: [
[:get, 'session#current'],
[:get, 'users#topic_tracking_state'],
[:get, 'list#unread'],
[:get, 'list#new'],
[:get, 'list#latest']
],
+ calendar: [ [:get, 'users#bookmarks_cal', true ] ],
}
(A parte: perché stiamo usando array annidati qui…)