OAuth-1.0a module ionic usage


#1

Hi all,

I installed oauth-1.0a npm and crypto-js. After importing OAuth like import {OAuth} from 'oauth-1.0a'; and call OAuth on ionViewDidEnter, I’ve got:

HomePage ionViewDidEnter error: __webpack_require__.i(...) is not a function

Here is the code of whole home.ts

import { Component } from '@angular/core';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';

import {OAuth} from 'oauth-1.0a';
import {CryptoJS} from 'crypto-js';

@Component({
  templateUrl: 'home.html'
})
export class HomePage {


	constructor( private http: Http ) {}

	ionViewDidEnter() {


	    var a ='a';
	    console.log(a);

	    var oauth = OAuth({
		    consumer: {
		        key: 'UI7K39BihwtH',
		        secret: 'Ro0g8VL4L3OySYaSI11urZLmrnn0baEWJnDgHj3bJ54sqa4E'
		    },
		    signature_method: 'HMAC-SHA1',
		    hash_function: function(base_string, key) {
		        return CryptoJS.HmacSHA1(base_string, key).toString(CryptoJS.enc.Base64);
		    }
		});


	}
}

Thanks in advance :slight_smile:


#2

Didyou get these packages working? I have problem getting them working but a bit different from yours, if all is well, will you please share code that worked.