How to use login api of alfresco-js-api in IONIC project ?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member

How to use login api of alfresco-js-api in IONIC project ?

Jump to solution

Hi, I am trying to implement login api from https://github.com/Alfresco/alfresco-js-api in IONIC project and getting this error.

Here is the .ts file for the reference

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AlfrescoApi } from 'alfresco-js-api';
import * as alfrescoJsApi from 'alfresco-js-api';

@IonicPage()
@Component({
selector: 'page-signup',
templateUrl: 'signup.html',
})

export class SignupPage {
constructor(
public navCtrl: NavController,
public navParams: NavParams,
)
{
}

this.alfrescoJsApi = <AlfrescoApi> new alfrescoJsApi({ hostEcm:'http://127.0.0.1:8090' });
//this.alfrescoJsApi = AlfrescoApi({ hostEcm:'http://127.0.0.1:8090' });
this.alfrescoJsApi.login('admin', 'admin').then(function (data) {
console.log('API called successfully Login in BPM and ECM performed ');
}, function (error) {
console.error(error);
});

// ionViewDidLoad() {
// console.log('ionViewDidLoad SignupPage');
// }

}
1 Solution

Accepted Solutions
Highlighted
Alfresco Employee

Re: How to use login api of alfresco-js-api in IONIC project ?

Jump to solution
alfrescoApi: AlfrescoApi;
this.alfrescoApi = <AlfrescoApi> new alfrescoApi({
provider: 'YOUR_CONFIG',
hostEcm: 'YOUR_CONFIG',
hostBpm: 'YOUR_CONFIG',
authType: 'YOUR_CONFIG',
contextRootBpm: 'YOUR_CONFIG',
contextRoot: 'YOUR_CONFIG',
disableCsrf: 'YOUR_CONFIG',
oauth2: 'YOUR_CONFIG'
});

Can you try Like the code above?

We use it in ADF like that:

alfresco-ng2-components/alfresco-api.service.ts at master · Alfresco/alfresco-ng2-components · GitHu... 

View solution in original post

1 Reply
Highlighted
Alfresco Employee

Re: How to use login api of alfresco-js-api in IONIC project ?

Jump to solution
alfrescoApi: AlfrescoApi;
this.alfrescoApi = <AlfrescoApi> new alfrescoApi({
provider: 'YOUR_CONFIG',
hostEcm: 'YOUR_CONFIG',
hostBpm: 'YOUR_CONFIG',
authType: 'YOUR_CONFIG',
contextRootBpm: 'YOUR_CONFIG',
contextRoot: 'YOUR_CONFIG',
disableCsrf: 'YOUR_CONFIG',
oauth2: 'YOUR_CONFIG'
});

Can you try Like the code above?

We use it in ADF like that:

alfresco-ng2-components/alfresco-api.service.ts at master · Alfresco/alfresco-ng2-components · GitHu... 

View solution in original post