Skip to content

Conversation

hiranya911
Copy link
Contributor

Some minor syntactic changes are being made to the v3.0 branch in anticipation of the upcoming cookie management API.

  • Renamed and moved some of the internal functions/variables around for clarity.
  • Updated some of the error messages to be more Go-idiomatic

if err := decode(s, &claims); err != nil {
return err
}
if err := decode(s, t); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's worth adding a comment explaining why you need to decode twice.

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

auth/auth.go Outdated
verifyTokenMsg := "See https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to " +
"retrieve a valid ID token."
verifyTokenMsg := "see https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to " +
"retrieve a valid id token."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Technically, go error messages shouldn't end with punctuation.

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

auth/auth.go Outdated

projectIDMsg := "Make sure the ID token comes from the same Firebase project as the credential used to" +
projectIDMsg := "make sure the id token comes from the same Firebase project as the credential used to" +
" authenticate this SDK."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Technically, go error messages shouldn't end with punctuation.

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

@hiranya911 hiranya911 assigned hiranya911 and unassigned bklimt Apr 19, 2018
@hiranya911 hiranya911 merged commit 2bbc692 into breaking_context_change Apr 19, 2018
@hiranya911 hiranya911 deleted the hkj-auth-cleanup branch April 19, 2018 20:49
return err
}

for _, r := range []string{"iss", "aud", "exp", "iat", "sub", "uid"} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe another comment here like "Delete the standard claims from the custom claims map."

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

hiranya911 pushed a commit that referenced this pull request May 7, 2018
* context signatures

* VerifyIDToken context

* custom token context

* fix context arguments

* custom token with claims context

* remove TODO

* integration_iid_name

* propagate ctx

* propagate to private functions

* snippets and tests ctx

* integration test user2 fix

* error message

* Revert "integration test user2 fix"

This reverts commit 57148ce.

* add context to AE, fix integration test after merge.

* Revert "error message"

This reverts commit db7c34a.

* Merged with latest dev

* Using the 1.6 import for context

* Dropping call to WithContext

* Cleaning up the auth package (#134)

* Cleaning up the auth package

* Variable grouping

* Removing some punctuation; Changed id to ID in error messages

* Adding a minor comment

* Cleaning up the auth (user management) code (#136)

* Cleaning up the auth (user management) code

* Added a few more tests

* Removed the fields inner type from UserToCreate and UserToUpdate

* Renamed _req variables; More consistent error messages
hiranya911 added a commit that referenced this pull request May 8, 2018
* Breaking context change (#88)

* context signatures

* VerifyIDToken context

* custom token context

* fix context arguments

* custom token with claims context

* remove TODO

* integration_iid_name

* propagate ctx

* propagate to private functions

* snippets and tests ctx

* integration test user2 fix

* error message

* Revert "integration test user2 fix"

This reverts commit 57148ce.

* add context to AE, fix integration test after merge.

* Revert "error message"

This reverts commit db7c34a.

* Merged with latest dev

* Using the 1.6 import for context

* Dropping call to WithContext

* Cleaning up the auth package (#134)

* Cleaning up the auth package

* Variable grouping

* Removing some punctuation; Changed id to ID in error messages

* Adding a minor comment

* Cleaning up the auth (user management) code (#136)

* Cleaning up the auth (user management) code

* Added a few more tests

* Removed the fields inner type from UserToCreate and UserToUpdate

* Renamed _req variables; More consistent error messages

* Removing golint checks from 1.6.x build (#141)

* Removing golint checks from 1.6.x build

* Minor reformat

* Bumped version to 3.0.0 (#142)

* Bumped version to 3.0.0

* Updated changelog
hiranya911 pushed a commit that referenced this pull request Jun 12, 2018
* context signatures

* VerifyIDToken context

* custom token context

* fix context arguments

* custom token with claims context

* remove TODO

* integration_iid_name

* propagate ctx

* propagate to private functions

* snippets and tests ctx

* integration test user2 fix

* error message

* Revert "integration test user2 fix"

This reverts commit 57148ce.

* add context to AE, fix integration test after merge.

* Revert "error message"

This reverts commit db7c34a.

* Merged with latest dev

* Using the 1.6 import for context

* Dropping call to WithContext

* Cleaning up the auth package (#134)

* Cleaning up the auth package

* Variable grouping

* Removing some punctuation; Changed id to ID in error messages

* Adding a minor comment

* Cleaning up the auth (user management) code (#136)

* Cleaning up the auth (user management) code

* Added a few more tests

* Removed the fields inner type from UserToCreate and UserToUpdate

* Renamed _req variables; More consistent error messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants