Method: Google::Auth::WebUserAuthorizer.validate_callback_state
- Defined in:
- lib/googleauth/web_user_authorizer.rb
.validate_callback_state(state, request) ⇒ Object
Verifies the results of an authorization callback
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/googleauth/web_user_authorizer.rb', line 250 def self.validate_callback_state state, request if state[AUTH_CODE_KEY].nil? raise AuthorizationError.with_details( MISSING_AUTH_CODE_ERROR, credential_type_name: name, principal: principal ) end if state[ERROR_CODE_KEY] raise AuthorizationError.with_details( format(AUTHORIZATION_ERROR, state[ERROR_CODE_KEY]), credential_type_name: name, principal: principal ) elsif request.session[XSRF_KEY] != state[SESSION_ID_KEY] raise AuthorizationError.with_details( INVALID_STATE_TOKEN_ERROR, credential_type_name: name, principal: principal ) end end |