forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redwoodjs#769 from Terris/add-gotrue-auth-gen
Add a GoTrue-JS provider to the CLI auth generator
- Loading branch information
Showing
2 changed files
with
35 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/cli/src/commands/generate/auth/providers/goTrue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// the lines that need to be added to index.js | ||
export const config = { | ||
imports: [`import GoTrue from 'gotrue-js'`], | ||
init: `const goTrueClient = new GoTrue({ | ||
APIUrl: 'https://MYAPP.netlify.app/.netlify/identity', | ||
setCookie: true, | ||
})`, | ||
authProvider: { | ||
client: 'goTrueClient', | ||
type: 'goTrue', | ||
}, | ||
} | ||
|
||
// required packages to install | ||
export const packages = ['gotrue-js'] | ||
|
||
// any notes to print out when the job is done | ||
export const notes = [ | ||
'You will need to enable Identity on your Netlify site and set APIUrl to your API endpoint in your GoTrue client config.', | ||
'See: https://github.com/redwoodjs/redwood/blob/main/packages/auth/README.md#for-gotrue-js', | ||
] |