Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capacitor-community/auth0
https://github.com/capacitor-community/auth0
auth0 capacitor
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/capacitor-community/auth0
- Owner: capacitor-community
- License: mit
- Archived: true
- Created: 2020-07-13T21:06:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-07-14T02:58:31.000Z (over 4 years ago)
- Last Synced: 2024-08-03T23:04:36.645Z (4 months ago)
- Topics: auth0, capacitor
- Language: TypeScript
- Homepage:
- Size: 188 KB
- Stars: 9
- Watchers: 7
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-capacitorjs - @capacitor-community/auth0 - A native plugin for Auth0 authentication provider. (Plugins / Community Plugins)
README
Auth0
@capacitor-community/auth0
(WORK IN PROGRESS)
A native plugin for Auth0 authentication provider## Maintainers
| Maintainer | GitHub | Social |
| ------------- | ------------------------------------------- | ------------------------------------------------ |
| Priyank Patel | [priyankpat](https://github.com/priyankpat) | [@priyankpat\_](https://twitter.com/priyankpat_) |## Installation
Using npm:
```bash
npm install @capacitor-community/auth0
```Using yarn:
```bash
yarn add @capacitor-community/auth0
```Sync native files:
```bash
npx cap sync
```On iOS, no further steps are needed.
On Android, make changes to the following files:
`AndroidManifest.xml`:
Replace **AUTH0_HOST** with Tenant Domain provided by Auth0.
```xml
```
`MainActivity.java`:
```java
import com.getcapacitor.community.auth0.Auth0;public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);// Initializes the Bridge
this.init(
savedInstanceState,
new ArrayList>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
add(Auth0.class);
}
}
);
}
}
```## Supported methods
| Name | Android | iOS | Web |
| :------------------------------ | :------ | :-- | :-- |
| authorize | ✅ | ✅ | ❌ |
| clearSession | ✅ | ✅ | ❌ |## Usage
```typescript
import Auth0 from '@capacitor-community/auth0';/*
* Create a new instance of the client using the Auth0 domain and client id.
*/
const auth0 = new Auth0({
domain: 'DOMAIN',
clientId: 'CLIENT_ID',
});/**
* Platform: Android/iOS
* This method trigger a auth0 web authentication.
* @params scope - list of scope seperated by whitespace
* @returns void
*/
auth0.webAuth
.authorize({ scope: 'openid email profile' })
.then(credentials => console.log(credentials))
.catch(error => console.log(error));/**
* Platform: Android/iOS
* This method trigger a auth0 logout.
* @params scope - list of scope seperated by whitespace
* @returns void
*/
auth0.webAuth.clearSession().catch(error => console.log(error));// Management API (Users) (Coming Soon)
// Authentication API (Coming Soon)```