Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPFS Issue : 401 (Unauthorized) project id required #10

Closed
shamil-t opened this issue Aug 21, 2022 · 3 comments
Closed

IPFS Issue : 401 (Unauthorized) project id required #10

shamil-t opened this issue Aug 21, 2022 · 3 comments
Assignees

Comments

@shamil-t
Copy link
Owner

POST https://ipfs.infura.io:5001/api/v0/add?pin=true 401 (Unauthorized)
    core.mjs:6461 ERROR Error: Uncaught (in promise): Error: [ipfs-mini] status 401: project id required

Error: [ipfs-mini] status 401: project id required

image

@shamil-t
Copy link
Owner Author

shamil-t commented Aug 21, 2022

create an account in infura

then add a aproject.

install ipfs-http-client

npm i ipfs-http-client@52.0.4-rc.4

modify

src\service\ipfs.service.ts

import { Injectable } from "@angular/core";

const ipfsClient = require("ipfs-http-client");

@Injectable({
  providedIn: "root",
})
export class IpfsService {
  ipfs: any;
  constructor() {
    const projectId = "*****";
    const projectSecret = "***";
    const auth =
      "Basic " +
      Buffer.from(projectId + ":" + projectSecret).toString("base64");

    this.ipfs = ipfsClient.create({
      host: "localhost",
      port: 5001,
      protocol: "http",
      headers: {
        autherization: auth,
      },
    });
  }

  getIPFS() {
    return this.ipfs;
  }
}

@shamil-t
Copy link
Owner Author

Also you can install IPFS locally using go-ipfs

go-ipfs installation

@shamil-t
Copy link
Owner Author

shamil-t commented Oct 5, 2022

#12

resolved IPFS issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant