Skip to content

Conversation

@erickoledadevrel
Copy link
Contributor

Fixes #131

Copy link
Contributor

@grant grant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nits. LGTM o.w.

test/test.js Outdated
foo: 'bar'
});

// Extract the state token from the URL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful if you gave an example IN and OUT.
IN: http://www.foo.hk/bar?baz=bat
OUT: ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

```js
var authorizationUrl = getService().getAuthorizationUrl({
lang: 'fr'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not obvious that lang: 'fr' is an example, or what this sample does.
Can you say something like:

for example, we're passing a simple object { lang: 'fr' } to our OAuth2 state token.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

to the PropertiesService is expensive and not neccessary in the case where the
user doesn't start or fails to complete the OAuth flow.
As an alternative you can store small amounts of data in the OAuth2 `state`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling this state, could we just call it parameter in the docs and say it is persisted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state parameter is a formal part of the OAuth2 spec:

state
RECOMMENDED. An opaque value used by the client to maintain
state between the request and callback. The authorization
server includes this value when redirecting the user-agent back
to the client. The parameter SHOULD be used for preventing
cross-site request forgery as described in Section 10.12.

https://tools.ietf.org/html/rfc6749#section-4.1.1

I'd prefer to stick with the formal name, since different OAuth2 providers may handle it differently.

README.md Outdated
```
These values will be stored along-side Apps Script's internal information in the
cryptographically secure `state` token, which is passed in the authorization URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cryptographically secure

I think we say encrypted in the docs. I'd rather not say "cryptographically secure" unless we link the docs to the cipher we're using for this token.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

README.md Outdated
These values will be stored along-side Apps Script's internal information in the
cryptographically secure `state` token, which is passed in the authorization URL
and passed back to the redirect URI. The `state` token is automatically
decrypted in the callback function, and you can access your parameters using the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using "and", you could just separate these conjoined sentence into two sentences.

function. You can...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the and, but removing the comma.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants