Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVA-403 Adds authentication API #200

Merged
merged 5 commits into from
Oct 25, 2023
Merged

SVA-403 Adds authentication API #200

merged 5 commits into from
Oct 25, 2023

Conversation

roryf
Copy link
Contributor

@roryf roryf commented Oct 16, 2023

Description

https://sta2020.atlassian.net/browse/SVA-403

Adds /auth endpoints to support Cognito-based authentication in the app.

Requires config updates to set Cognito env vars, depends on setting up Cognito correctly.

Type of change

Please delete options that are not relevant

  • Bug fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking change(fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing locally

Won't currently work locally or otherwise...

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have removed any unnecessary comments or console logging
  • I have made corresponding changes to the documentation (if required)
  • I have addressed accessibility, if needed
  • I have followed best practices, e.g. NativeBase approaches and theming
  • I have checked the app in dark mode, if making front-end design changes
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the version numbers in package.json files in the app and/or api directories as needed

@@ -1,11 +1,13 @@
const express = require('express');
const express = require("express");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prettier decided everything needed double quotes, will update once #198 lands

@roryf roryf marked this pull request as ready for review October 18, 2023 17:18
Copy link
Collaborator

@PammyLo PammyLo left a comment

Choose a reason for hiding this comment

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

Many thanks for getting this started @roryf
Can't test locally but doesn't break anything and code looks good :)

@M4RC1N76 M4RC1N76 self-requested a review October 19, 2023 13:00
@DJMF2015 DJMF2015 self-requested a review October 19, 2023 16:43
Copy link
Contributor

@DJMF2015 DJMF2015 left a comment

Choose a reason for hiding this comment

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

@roryf i have taken a look over the code changes and run the unit tests (all of which pass). I can't see anything that stands out that requires needing to be changed. I appreciate there is further work to do with Cognito going forward. Looks great work and thanks for doing this. Happy to approve.

@roryf roryf mentioned this pull request Oct 20, 2023
4 tasks
@roryf
Copy link
Contributor Author

roryf commented Oct 25, 2023

Merging now as doesn't break existing functionality, even though new endpoints will currently fail.

@roryf roryf merged commit c29c397 into develop Oct 25, 2023
1 check passed
@roryf roryf deleted the sva-403-auth-api branch October 26, 2023 13:09
roryf added a commit that referenced this pull request Oct 27, 2023
# Description

Authentication services within app.

Adds `AuthProvider` which is configured at app level and can be consumed
in any component via `useAuth` hook. Added a placeholder example of
detecting auth state in `ProfileContainer`

There is an underlying `AuthClient` class which handles specific API
interaction and storage of auth credentials, which uses
[`expo-secure-store`](https://docs.expo.dev/versions/latest/sdk/securestore/).
This also manages automatically refreshing auth tokens when access token
expires, and handling transient network errors (which will happen a
lot).

Also configured jest correctly so we can add tests, and removed unused
`app/__tests__` directory (I strongly prefer test files to sit with the
file under test). Rejigged the app CI build too so it runs the tests,
and lints all files not just changed (not convinced this worked
correctly tbh). I would very much like to revisit the different eslintrc
configs at some point, and the need for questionably useful (IMHO) file
comments.

Depends on backend in #200 

## Type of change

Please delete options that are not relevant

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Breaking change(fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# Testing locally

No user-facing features added, run the app, check nothing breaks and
there are no new console warnings.

# Checklist

- [] My code follows the style guidelines of this project
- [] I have performed a self-review of my own code
- [] I have commented my code, particularly in hard-to-understand areas
- [] I have removed any unnecessary comments or console logging
- [] I have made corresponding changes to the documentation (if
required)
- [] I have addressed accessibility, if needed
- [] I have followed best practices, e.g. NativeBase approaches and
theming
- [] I have checked the app in dark mode, if making front-end design
changes
- [] My changes generate no new warnings
- [] I have added tests that prove my fix is effective or that my
feature works
- [] New and existing unit tests pass locally with my changes
- [] I have updated the version numbers in `package.json` files in the
[app](DEPLOYMENT.md#app-deployment) and/or
[api](DEPLOYMENT.md#api-deployment-on-aws) directories as needed
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.

3 participants