Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nkalupahana/capacitor-spotify

Native Spotify authentication for Capacitor.
https://github.com/nkalupahana/capacitor-spotify

Last synced: 5 days ago
JSON representation

Native Spotify authentication for Capacitor.

Awesome Lists containing this project

README

        

# @getbaseline/capacitor-spotify

Native Spotify authentication for Capacitor.

## Install

```bash
npm install @getbaseline/capacitor-spotify
npx cap sync
```

## iOS Setup

1. Add a redirect URI to your app as a URL scheme. We recommend using reverse domain notation (e.g `app.getbaseline.baseline.spotify`).
2. Add the following to the beginning of `func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool` in `AppDelegate`:
```swift
if (url.scheme == "YOUR URL SCHEME FROM STEP 2 HERE ") {
NotificationCenter.default.post(name: NSNotification.Name("spotifyLogin"), object: url);
}
```
3. Add the following to your app's `Info.plist` (allows your app to open the Spotify app for auth):
```xml
LSApplicationQueriesSchemes

spotify

```

## API

* [`signIn(...)`](#signin)
* [Interfaces](#interfaces)

### signIn(...)

```typescript
signIn(options: SignInOptions) => Promise
```

| Param | Type |
| ------------- | ------------------------------------------------------- |
| **`options`** | SignInOptions |

**Returns:** Promise<SignInResult>

--------------------

### Interfaces

#### SignInResult

| Prop | Type |
| --------------- | ------------------- |
| **`resultUri`** | string |

#### SignInOptions

| Prop | Type |
| ----------------- | ------------------- |
| **`clientId`** | string |
| **`redirectUri`** | string |