react-signin-with-apple
v1.0.3
Published
NPM package for Login with Apple in a React application
Downloads
28
Maintainers
Readme
Login with apple
# Apple Login
NPM package for "Login with Apple" in a React application,
## Installation
```bash
npm install react-signin-with-apple
Usage
import { loginWithApple } from 'react-signin-with-apple';
const options = {
clientId: 'your-client-id', // example: 320840932792379823
clientSecret: 'your-client-secret',
redirectUri: 'your-redirect-uri',
code: 'authorization-code',
};
loginWithApple(options)
.then((result) => {
console.log('Login successful:', result);
})
.catch((error) => {
console.error('Login failed:', error);
});
Get your apple clientID from apple developer: https://www.apple.com/certificateauthority/
License
MIT
### 7. **Build and Publish**
Build your package and publish it to npm:
```bash
npx tsc
npm publish
Summary
- Dependencies:
jsonwebtoken
for decoding JWT tokens,axios
for HTTP requests. - Main Function:
loginWithApple
to handle Apple login by exchanging the authorization code for tokens. - Usage Example: Provides a sample code on how to use the package.
Now your react-signin-with-apple
package should be ready to handle Apple login and OAuth2 flow. You can publish it to npm for others to use.