Changes to OAuth2 authentication JSON output #48
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example code located on the Google developers site for Ruby (https://developers.google.com/api-client-library/ruby/auth/web-app) utilizes the JSON output of the authentication information in a stored session for creating the OAuth2 client. While this works correctly for the first fetch of the access token, the JSON output does not provide adequate information regarding the expiration of the access token. With out the expiration information it is impossible to track and test for an expired access token in subsequent API executions. The changes in this PR add the expires_in and issued_at parameters to the JSON output which allows the client to properly track and verify if the access token has expired.
Additionally, while testing the creation of an OAuth2 client using the JSON output I came across an exception with how the authorization URI was being created. The following error was reported:
The issue was the result of mismatched hash key types ... the resulting merge of the query_values hash had a mix of both Symbol and String key types. This PR includes changes to normalize the query_values hash before the merge.