react-apple-signin-auth alternatives and similar libraries
Based on the "Miscellaneous" category.
Alternatively, view react-apple-signin-auth alternatives based on common mentions on social networks and blogs.
-
react-pdf
Display PDFs in your React app as easily as if they were images. -
typography
A powerful toolkit for building websites with beautiful design -
react-resizable-and-movable
🖱 A resizable and draggable component for React. -
react-simple-chatbot
:speech_balloon: Easy way to create conversation chats -
react-awesome-query-builder
User-friendly query builder for React -
react-resizable-box
📏 A resizable component for React. -
react-pdf-viewer
A React component to view a PDF document -
react-json-tree
React JSON Viewer Component, Extracted from redux-devtools. -
react-facebook
Facebook components like a Login button, Like, Share, Chat, Comments, Page or Embedded Post -
react-avatar
Universal avatar makes it possible to fetch/generate an avatar based on the information you have about that user. -
react-blur
React component to blur image backgrounds using canvas. -
chessboardjsx
:black_square_button: Chessboard built for React -
react-darkreader
🌓 A React Hook for adding a dark / night mode to your site. -
react-images-uploader
React.js component for uploading images to the server -
react-svg-buttons
React configurable animated svg buttons -
react-file-reader-input
React file input component for complete control over styling and abstraction from file reading. -
react-dnr
Dragable and Resizable window build with React.js -
react-tabguard
Limit tabbing within specified area with an ease -
react-swipeable-list
Swipeable list component for React supporting several behaviours (e.g. iOS) -
material-color-hash
Hash strings to Material UI colors -
react-avatar-generator
Generate fun kaleidoscope for user avatars. -
react-headings
⚛ Auto-increment your HTML headings (h1, h2, etc.) for improved accessibility and SEO. -
react-swipe-to-delete-ios
A simple React component to reproduce the way iOS deletes an item in a list -
react-filter-control
The react UI component for building complex filter criteria -
react-advanced-news-ticker
A powerful, flexible, lightweight and animated vertical news ticker component for React. -
react-demo-tab
📑 React component to easily create demos of other components -
@restpace/schema-form
A React component package for generating forms based on (almost) the full power of JSON Schema -
react-searchbox-awesome
The coolest searchbox for React.js! -
react-customizable-chat-bot
Customizable chat bot library using React and Typescript -
react-pulse-text
React component that allows you to animate the text you want -
react-color-scroll
Blend through colors as you scroll down the page. -
fastcomments-react
A React component for FastComments -
react-mouse-select
A simple react library for selecting elements by moving the mouse -
react-cloud-letter
Wrap your letter in lovely cloud-like shape with React. -
react-pagespeed-score
A React component for display a dial-type chart of PageSpeed Insights.
Appwrite - The Open Source Firebase alternative introduces iOS support
Do you think we are missing an alternative of react-apple-signin-auth or a related project?
README
react-apple-signin-auth
Apple signin for React using the official Apple JS SDK
Checkout the demo for a quick start!
Prerequisites
- You should be enrolled in Apple Developer Program.
- Please have a look at Apple documentation related to "Sign in with Apple" feature.
- You should create App ID and Service ID in your Apple Developer Account.
- You should generate private key for your Service ID in your Apple Developer Account.
Apple Signin Setup
Deatiled confuguration instructions can be found at blog post and Apple docs and official apple docs for webpage signin.
Installation
npm i react-apple-signin-auth
OR
yarn add react-apple-signin-auth
Usage
Checkout the demo for a quick start!
import AppleSignin from 'react-apple-signin-auth';
/** Apple Signin button */
const MyAppleSigninButton = () => (
<AppleSignin
/** Auth options passed to AppleID.auth.init() */
authOptions={{
/** Client ID - eg: 'com.example.com' */
clientId: 'com.example.web',
/** Requested scopes, seperated by spaces - eg: 'email name' */
scope: 'email name',
/** Apple's redirectURI - must be one of the URIs you added to the serviceID - the undocumented trick in apple docs is that you should call auth from a page that is listed as a redirectURI, localhost fails */
redirectURI: 'https://example.com',
/** State string that is returned with the apple response */
state: 'state',
/** Nonce */
nonce: 'nonce',
/** Uses popup auth instead of redirection */
usePopup: ${authOptions.usePopup},
}} // REQUIRED
/** General props */
uiType="dark"
/** className */
className="apple-auth-btn"
/** Removes default style tag */
noDefaultStyle={false}
/** Allows to change the button's children, eg: for changing the button text */
buttonExtraChildren="Continue with Apple"
/** Extra controlling props */
/** Called upon signin success in case authOptions.usePopup = true -- which means auth is handled client side */
onSuccess={(response) => console.log(response)} // default = undefined
/** Called upon signin error */
onError={(error) => console.error(error)} // default = undefined
/** Skips loading the apple script if true */
skipScript={false} // default = undefined
/** Apple image props */
iconProp={{ style: { marginTop: '10px' } }} // default = undefined
/** render function - called with all props - can be used to fully customize the UI by rendering your own component */
render={(props) => <button {...props}>My Custom Button</button>}
/>
);
export default MyAppleSigninButton;
Note about the response's user
object
onSuccess
response object will contain the user object on the first time attempt only. Meaning if you make another signIn attempt for the same account you will not get the user object.
Raw JS functionality
a module called appleAuthHelpers
is also exported to allow you to use the functionality without using the UI or relying on React. This works with any kind of frontend JS, eg: react, vue, etc... Note that you need to load the apple script yourself.
- Importing the apple script: ```js // using raw html:
// OR using react hooks: import { useScript, appleAuthHelpers } from 'react-apple-signin-auth';
const myComponent = () => { useScript(appleAuthHelpers.APPLE_SCRIPT_SRC); // ... };
export default myComponent;
- Using appleAuthHelpers:
```js
import { appleAuthHelpers } from 'react-apple-signin-auth';
// OR
// import appleAuthHelpers from 'react-apple-signin-auth/dist/appleAuthHelpers'; // @unstable - might change with upgrades
/**
* perform apple signIn operation
*/
appleAuthHelpers.signIn({
authOptions: {
// same as above
},
onSuccess: (response) => console.log(response),
onError: (error) => console.error(error),
});
// OR
/** promisified version - promise resolves with response on success or undefined on error -- note that this only work with usePopup: true */
const response = await appleAuthHelpers.signIn({
authOptions: {
// same as above
},
onError: (error) => console.error(error),
});
if (response) {
console.log(response);
} else {
console.error('Error performing apple signin.');
}
Server-side authentication (nodeJS backend)
Another library exists for server/backend support for Apple signin apple-signin-auth
Usage
- Install the library
yarn add apple-signin-auth
ORnpm i apple-signin-auth
- Implement JWT verification logic ```js const appleSignin = require("apple-signin-auth");
const { authorization, user } = req.body;
try { const { sub: userAppleId } = await appleSignin.verifyIdToken( authorization.id_token, // We need to pass the token that we wish to decode. { audience: "com.example.web", // client id - The same one we used on the frontend, this is the secret key used for encoding and decoding the token. nonce: 'nonce' // nonce - The same one we used on the frontend - OPTIONAL } ); } catch (err) { // Token is not verified console.error(err); }
#### Further resources:
- https://dev.to/onygami/how-to-add-signin-with-apple-on-your-website-43m9
### Related Projects
- [Apple Signin for Node JS](https://github.com/A-Tokyo/apple-signin-auth)
- [Apple Signin for React Native](https://github.com/invertase/react-native-apple-authentication)
## Contributing
Pull requests are highly appreciated! For major changes, please open an issue first to discuss what you would like to change.
### Getting Started
- Clone the repo: `git clone https://github.com/a-tokyo/react-apple-signin-auth`
- Install deps: `yarn`
- Start webpack development server on [localhost:3001](http://localhost:3001): `yarn start`
- To run/update the tests locally, run: `yarn test -u`