1.0.6 • Published 1 month ago

ngx-apple-login v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 month ago

Angular Apple Login

This library was generated with Angular CLI version 13.3.0.

Compatibility Matrix

Library VersionAngular Version
>=1.0.613

Getting started

Install via npm

npm i ngx-apple-login

Import the module

In your AppModule, import the NgxAppleLoginModule

import { NgxAppleLoginModule } from 'ngx-apple-login';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    NgxAppleLoginModule
  ],
})

export class AppModule { }

Usage

In Template use

<ngx-apple-login [noDefaultStyle]="true" [uiType]="'dark'" [buttonLabel]="'Signup'" [config]="config" (onSuccess)="handleOnSuccess($event)" (onError)="handleError($event)"></ngx-apple-login>

In Component use

import { AppleAuthOptions } from 'ngx-apple-login/entities/apple-auth-options'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})

export class AppComponent  {

  config: AppleAuthOptions = {
    clientId: 'com.example.com',
    scope: 'email name',
    usePopup: true,
    redirectURI: '/'
  }

  handleOnSuccess(event: any){
    // Success Response
  }

  handleError(event: any){
    // Error Response
  }
}

Using Service Only

import { NgxAppleLoginService } from 'ngx-apple-login';
import { AppleAuthOptions } from 'ngx-apple-login/entities/apple-auth-options'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})

export class AppComponent  {

  config: AppleAuthOptions = {
    clientId: 'com.example.com',
    scope: 'email name',
    usePopup: true,
    redirectURI: '/'
  }
  
  constructor(private ngxAppleLoginService: NgxAppleLoginService){}
  
  signIn(){
    this.ngxAppleLoginService.signIn(this.config).then((res) => {
      // Success Response
    }).catch((error) => {
      // Error Response
    })
  }

}

API

InputTypeDefaultRequiredDescription
noDefaultStylebooleanfalsenoprevents rendering of default styles
uiTypedark | lightdarknoUT type
buttonLabelstringContinue with ApplenoButton text
configAppleAuthOptions-yesApple config
classstring-noExternal class
(onSuccess)EventEmitter-noSuccess callback
(onError)EventEmitter-noError callback

AppleAuthOptions

KeyTypeRequiredDescription
clientIdstringyesClient ID - eg: 'com.example.com'
scopestringyesRequested scopes, seperated by spaces - eg: 'email name'
redirectURIstringnoApple'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
usePopupbooleanyesUses popup auth instead of redirection
statestringnoState string that is returned with the apple response
noncestringnoNonce
1.0.2

1 month ago

1.0.6

1 month ago

1.0.5

1 month ago

1.0.4

1 month ago

1.0.3

1 month ago

1.0.1

2 months ago

1.0.0

2 months ago

0.1.0

2 months ago

0.0.12

2 months ago

0.0.11

2 months ago

0.0.10

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.4

2 months ago

0.0.3

2 months ago

0.0.2

2 months ago

0.0.1

2 months ago