Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Add AWS Amplify Auth service as a Provider #786

Closed
borisdayma opened this issue Aug 2, 2020 · 2 comments
Closed

Add AWS Amplify Auth service as a Provider #786

borisdayma opened this issue Aug 2, 2020 · 2 comments

Comments

@borisdayma
Copy link

borisdayma commented Aug 2, 2020

What problem does this feature solve?

With the popularity of AWS Amplify for creating quickly backend (files, lambda functions, auth through Cognito…) and host apps, it would be great to add direct support to it through nuxt-auth module.

What does the proposed changes look like?

With this integration, we will be able to easily protect pages and set up which ones require login by checking authentication status through aws cognito.

For now, I typically create my own middleware which is far from being as clean as nuxt-auth.

I'm wondering if the best approach is to add support through nuxt-auth or if a new nuxt-amplify would make more sense.

This feature request is available on Nuxt community (#c632)
@bmulholland
Copy link
Contributor

PRs to add this would be welcome!

@maoosi
Copy link

maoosi commented Jan 26, 2021

One of my projects is using nuxt/auth and amplify - in that context, I have created a really simple (custom) scheme for it.

I’m not able to spend more time on this at the moment. However, if anyone wants to look at the code to start working on a PR, then feel free to do so! https://gist.github.com/maoosi/04899cdcdebf097001f498820caeffd2

Few notes:

  • The code leverage withSSRContext to make it compatible with nuxt SSR mode.
  • When using the @aws-amplify/ui-components package for the UI, then almost everything is already handled for you and the only requirement is to call await this.$auth.fetchUser() after login from the UI component. But it would be better to expose more of the amplify methods for flexibility around implementation.
  • Amplify can be used for more than just auth purpose, meaning one might need to call Amplify.configure() before the auth scheme gets mounted. So far, I’ve found the best way to share the config between other components and the scheme (both client and server-side), was to leverage the store. Just something to keep in mind when working on the PR.

@nuxt-community nuxt-community locked and limited conversation to collaborators Jan 19, 2022
@bmulholland bmulholland converted this issue into discussion #1475 Jan 19, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants