nextjs-basic-auth

时间:2021-05-06 11:23:04
【文件属性】:
文件名称:nextjs-basic-auth
文件大小:157KB
文件格式:ZIP
更新时间:2021-05-06 11:23:04
TypeScript NextJS基本认证 通过此软件包,可以轻松地将Basic HTTP Auth添加到您的Next.js应用程序中。 请注意,它需要你选择静态生成出来要保护,因为它需要内部被称为事实上的任何路由getServerSideProps 。 安装 yarn add nextjs-basic-auth 设置 通过导入并传递包含包含users密钥的对象进行初始化,该对象的值应为用户数组(将user和password用作每个相应用户对象的密钥): import initializeBasicAuth from 'nextjs-basic-auth' const users = [ { user: 'user1', password: 'toocool' }, { user: 'admin', password: 'password' }, ] const basicAuthCheck = in
【文件预览】:
nextjs-basic-auth-master
----.gitignore(34B)
----tsconfig.json(1KB)
----README.md(1KB)
----.github()
--------workflows()
----test()
--------findAndCheckUser.test.ts(692B)
--------authHeaderToBase64.test.ts(461B)
--------init.test.ts(452B)
----LICENSE(1KB)
----package.json(1KB)
----src()
--------types.ts(60B)
--------utils()
--------checkBasicAuth.ts(744B)
--------index.ts(487B)
----yarn.lock(384KB)

网友评论