# Using internet identity in a script

**URL:** <https://forum.dfinity.org/t/using-internet-identity-in-a-script/7666>\
**Category:** Developers\
**Created:** [October 3, 2021, 1:05am UTC](https://forum.dfinity.org/t/using-internet-identity-in-a-script/7666 "2021-10-03T01:05:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinli](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kevinli](https://forum.dfinity.org/u/kevinli)\
**Post date:** [October 3, 2021, 1:05am UTC](https://forum.dfinity.org/t/using-internet-identity-in-a-script/7666/1 "2021-10-03T01:05:28Z")

</div>

Okay so I’m writing a script to call certain functions of a canister that require me to have certain permissions (caller must be a certain principal).

```auto
const canisterId = "rrkah-fqaaa-aaaaa-aaaaq-cai";
const host = "http://localhost:8000/";
    const agent = new HttpAgent({ host });
    agent.fetchRootKey();
    const actor = Actor.createActor(someIDL, {
      agent,
      canisterId: canisterId,
    });    
    await (actor as any).callFunctionThatOnlyOwnerCanAccess();

```

How do I authorize myself from the script and make the call? Or would it be better to just try and make a command line script do the same thing so I can use dfx cli?

---

<div class="post-metadata">

**Author:** ![3cL1p5e7](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/3cl1p5e7/32/4649_2.png) [@3cL1p5e7](https://forum.dfinity.org/u/3cL1p5e7)\
**Post date:** [October 3, 2021, 11:20am UTC](https://forum.dfinity.org/t/using-internet-identity-in-a-script/7666/2 "2021-10-03T11:20:10Z")

</div>

Pass identity to HttpAgent

You can use Internet Identity canister to make login and get identity.  
Check this repo

> **[GitHub - 3cL1p5e7/rust-identity-template: Template project with Rust,...](https://github.com/3cL1p5e7/rust-identity-template)**
>
> Template project with Rust, Typescript and Internet Identity. Powered by Dfinity - GitHub - 3cL1p5e7/rust-identity-template: Template project with Rust, Typescript and Internet Identity. Powered by...
