Method: Sharepoint::Site#form_digest

Defined in:
lib/sharepoint-ruby.rb

#form_digestObject

Sharepoint uses ‘X-RequestDigest’ as a CSRF security-like. The form_digest method acquires a token or uses a previously acquired token if it is still supposed to be valid.



107
108
109
110
111
112
113
114
# File 'lib/sharepoint-ruby.rb', line 107

def form_digest
  if @web_context.nil? or (not @web_context.is_up_to_date?)
    @getting_form_digest = true
    @web_context         = query :post, "#{@protocol}://#{@url}/_api/contextinfo"
    @getting_form_digest = false
  end
  @web_context.form_digest_value
end